Skip to content
Proud to collaborate with Microsoft for Startups

agents.session-finalize ​

Aggregate metrics and mark an agent session as COMPLETED

Aggregate all step/cost metrics and mark the session COMPLETED.

Overview ​

PropertyValue
Workflow typeLinear
LibraryApp-agents
Version1.0

Triggers ​

SourceEndpoint / EventDescription
INTERNALinternal.invocationInternal — called by agents.session-watch when a runner exits

Input Schema ​

FieldTypeRequiredDefaultDescription
session_uuidstringYes——
organization_uuidstringYes——
exit_codeintegerNo——
result_summarystringNo——

Output Schema ​

FieldTypeRequiredDefaultDescription
errorstringNo——
error_typestringNo——
failed_atstringNo——
failed_at_statestringNo——
failed_layerjsonNo——
failed_stepstringNo——
failure_reasonstringNo——
session_uuidjsonNo——
statusjsonNo——
step_countjsonNo——
total_cost_usdjsonNo——
organization_uuidjsonNo——
exit_codejsonNo——
result_summaryjsonNo——

States ​

StateInitialTerminalSuccessAuto-advanceDescription
initiatedYesNo—run—
runNoNo—complete—
completedNoYesYes——
failedNoYesNo——

State Diagram ​

Transitions ​

FromActionToDescription
initiatedrunrun—
runcompletecompleted—
* (any state)failfailed—

API Usage ​

bash
POST /api/workflows/start
Content-Type: application/json

{
  "workflow_type": "agents.session-finalize",
  "initial_data": {
    "session_uuid": "value",
    "organization_uuid": "value"
  }
}