agents.session-watch ​
Poll runner workflow status and finalize the agent session when done
Poll the runner workflow and finalise the AgentSession when the runner exits.
Inputs ​
session_uuid : str — AgentSession.session_uuid organization_uuid : str — Organization UUID (must own the session) runner_workflow_uuid : str - workflow_uuid of the runner execution workflow to watch
Overview ​
| Property | Value |
|---|---|
| Workflow type | Linear |
| Library | App-agents |
| Version | 1.0 |
Triggers ​
| Source | Endpoint / Event | Description |
|---|---|---|
| INTERNAL | internal.invocation | Internal — started by the agents.session-launch DAG after runner launch |
Input Schema ​
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
session_uuid | string | Yes | — | AgentSession.session_uuid |
organization_uuid | string | Yes | — | Organization UUID that owns the session |
runner_workflow_uuid | string | No | — | Optional cloud launcher workflow UUID. DevKit watches the linked RunnerExecution directly. |
Output Schema ​
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
failure_reason | string | No | — | — |
failed_at | string | No | — | — |
failed_at_state | string | No | — | — |
failed_step | string | No | — | — |
failed_layer | json | No | — | — |
error | string | No | — | — |
error_type | string | No | — | — |
completed_at | string | No | — | — |
memory_entries_saved | integer | No | — | — |
step_count | integer | No | — | — |
total_cost_usd | json | No | — | — |
cancelled_at | string | No | — | — |
organization_uuid | string | No | — | — |
runner_workflow_uuid | string | No | — | — |
session_uuid | string | No | — | — |
_watch_decision | string | No | — | — |
watch_decision | string | No | — | — |
terminal_session_status | string | No | — | — |
watch_noop | boolean | No | — | — |
heartbeat_age_seconds | json | No | — | — |
activity_age_seconds | json | No | — | — |
last_activity_at | string | No | — | — |
since_start_seconds | json | No | — | — |
elapsed_seconds | json | No | — | — |
runner_failure_detail | json | No | — | — |
retried_from | string | No | — | — |
retry_count | integer | No | — | — |
States ​
| State | Initial | Terminal | Success | Auto-advance | Description |
|---|---|---|---|---|---|
watching | Yes | No | — | poll | — |
cancelling | No | No | — | finalize_cancel | — |
completing | No | No | — | finalize | — |
failing | No | No | — | finalize_failure | — |
routing | No | No | — | — | — |
cancelled | No | Yes | Yes | — | — |
completed | No | Yes | Yes | — | — |
failed | No | Yes | No | — | — |
State Diagram ​
Transitions ​
| From | Action | To | Description |
|---|---|---|---|
watching | poll | routing | — |
routing | route_complete | completing | — |
routing | route_fail | failing | — |
routing | route_cancel | cancelling | — |
routing | route_continue | watching | — |
completing | finalize | completed | — |
failing | finalize_failure | failed | — |
cancelling | finalize_cancel | cancelled | — |
* (any state) | fail | failed | — |
Outcomes ​
| Outcome | Type | Description | State Data Keys |
|---|---|---|---|
watched | SUCCESS | Agent session watch completed | session_uuid, terminal_session_status, organization_uuid |
cancelled | CANCELLED | Operation cancelled | session_uuid, terminal_session_status, organization_uuid |
failed | FAILURE | Agent session watch completed failed | failure_reason, error, error_type, failed_at_state, failed_step, failed_layer |
Business Errors ​
| Code | Message Template |
|---|---|
AGENTS_ORGANIZATION_CONTEXT_INVALID | Authenticated organization context is missing or does not match the workflow input |
AGENTS_SESSION_NOT_FOUND | Agent session {session_uuid} was not found in the organization |
AGENTS_CONFIG_NOT_FOUND | Agent configuration {agent_config_uuid} was not found in the organization |
AGENTS_RUNNER_GROUP_NOT_FOUND | Runner group {runner_group_uuid} was not found in the organization |
AGENTS_VALIDATION_FAILED | Workflow input or domain state failed validation: |
AGENTS_CONFLICT | Conflicting agent domain state: |
AGENTS_PROVIDER_FAILED | Upstream provider or runner call failed: |
AGENTS_MCP_CALL_FAILED | MCP tool call failed for {tool_name}: |
API Usage ​
bash
POST /api/workflows/start
Content-Type: application/json
{
"workflow_type": "agents.session-watch",
"initial_data": {
"session_uuid": "value",
"organization_uuid": "value"
}
}