Skip to content
🎉 Bem-vindo! Sinfonia by 27Devs é uma plataforma completa de orquestração de robôs, solicite já seu acesso.

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 lineEffect
bm_task_successAdds 1 successful Item.
bm_task_errorAdds 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_success and bm_task_error are singular, and bm_tasks_total is 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:

ProcessMarkers printedSuccessful ItemsFailed Items
Ended wellNoneDeclared total (zero if not declared)0
Ended wellOne or moreAs countedAs counted
Ended wellOnly bm_task_error01 (see the limitation below)
Ended with errorNone0Declared total (zero if not declared)
Ended with errorOnly bm_task_successAs counted1
Ended with errorSuccesses and failuresAs countedAs 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_total is 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

  1. Run the Bot and open the Execution in Executions to see the markers in the log.
  2. Wait for the Finance dashboard’s daily update. The Bot’s status in the Parameters tab stops being No Items reported.
  3. If you need the number sooner, an admin can use Recalculate period (see Troubleshooting).
Last updated on