Reporting Items
The Finance dashboard needs to know how many Items each Bot Execution processed. The Bot itself reports this, by printing simple lines to standard output (the print or console.log of your script). There is no environment variable, file or extra integration.
Warning
A Bot that does not report Items counts zero. It shows up on the dashboard with the Missing information warning and generates no Savings, even if every Execution ends successfully.
The markers
The Agent reads the Bot’s output line by line and recognizes three markers:
| Printed line | Effect |
|---|---|
bm_task_success | Adds 1 successful Item. |
bm_task_error | Adds 1 failed Item. |
bm_tasks_total=<N> | Declares the Execution’s total Items. If printed more than once, the last one counts. |
Format rules:
- Each marker takes the whole line. Leading and trailing spaces are ignored, but any other text on the same line makes the marker be ignored.
- Names are exact and lowercase. Note:
bm_task_successandbm_task_errorare singular, andbm_tasks_totalis plural. - Standard error (stderr) is read together with standard output, so the marker works on both.
- Make sure the output is not stuck in a buffer. In Python the Agent already runs with
PYTHONUNBUFFERED=1.
Recommended: one marker per Item
Print bm_task_success or bm_task_error as soon as each Item finishes. It is the most faithful form, because Items already processed count even if the Execution fails later.
for invoice in invoices:
try:
reconcile(invoice)
print("bm_task_success")
except Exception as error:
print(f"failure on invoice {invoice.number}: {error}")
print("bm_task_error")Regular log messages, such as failure on invoice 123, coexist with the markers as long as they are on another line.
Alternative: total only
If the Bot processes a batch that cannot be split, declare only the total. The result follows the process result: if it ends with exit code zero, all Items count as successful. If it ends with an error, all count as failed.
print(f"bm_tasks_total={len(rows)}")
process_batch(rows)How the Agent settles the count
At the end of the Execution, the Agent combines the markers with the process result:
| Process | Markers printed | Successful Items | Failed Items |
|---|---|---|---|
| Ended well | None | Declared total (zero if not declared) | 0 |
| Ended well | One or more | As counted | As counted |
| Ended well | Only bm_task_error | 0 | 1 (see the limitation below) |
| Ended with error | None | 0 | Declared total (zero if not declared) |
| Ended with error | Only bm_task_success | As counted | 1 |
| Ended with error | Successes and failures | As counted | As counted |
Practical consequences:
- Successful Items always count, even when the Execution ends with an error. Only they generate Savings and Hours saved.
- When using one marker per Item,
bm_tasks_totalis optional. The declared total is not reconciled with the markers.
Example. A Bot with 6 minutes per Item and $50.00 per hour prints 40 bm_task_success and 2 bm_task_error, and the Execution ends with an error. Sinfonia by 27Devs records 40 successful Items and 2 failed. The 40 generate 4 Hours saved and $200.00 of Savings, and the 2 failed generate nothing.
Known limitation
When the process ends well and the Bot printed only bm_task_error, with no bm_task_success, the Agent records 1 failure instead of the real count. This distorts the Success rate, but not the Savings.
To avoid it, end the process with an exit code other than zero when no Item succeeded.
Container Bots (Docker)
We do not support yet financial metrics for container Bots (published as a Docker image). We are working to measure this type of automation, and it will arrive in an upcoming update. Stay tuned for the next updates.
For now, container Executions do not read markers and the COE does not count their Items: they count only as Executions, the Bot shows Missing information and generates no Savings. The registered Investment still counts in the totals.
Environment preparation errors (the Agent fails before the Bot produces any output) count 1 failed Item and no Savings.
How to check
- Run the Bot and open the Execution in Executions to see the markers in the log.
- Wait for the Finance dashboard’s daily update. The Bot’s status in the Parameters tab stops being No Items reported.
- If you need the number sooner, an admin can use Recalculate period (see Troubleshooting).