Skip to main content
ntro.workflow.agents is the SDK surface for invoking a registered external agent from inside a runbook step. For the registration lifecycle, see Register agents.

Install

The agents module is part of the [workflow] extra.

invoke

Invokes a registered external agent and returns its result.

Arguments

Returns

AgentResult (pydantic):

Lifecycle

Activities calling invoke should give it a generous start_to_close_timeout — Anthropic Sessions can run for tens of minutes for complex agents.

File passback

Files persisted to the tenant data plane via invoke always carry source = 'agent_output:<ntropii-agent-id>'. They sit alongside user-uploaded documents in ingest.submitted_documents and are downloadable from the task UI like any other artefact. The period column on the row is NULL for agent outputs — period is a runbook-domain concept (some runbooks have it, some don’t), not part of the invocation contract. Runbooks that want the column populated should update the row downstream.

Polling semantics

The Anthropic Sessions API surfaces three terminal states: completed, failed, terminated. The adapter also treats idle with positive output_tokens as completed (the agent finished its work and went idle). The /v1/files index is eventually-consistent with session termination — files written in the agent’s final tool call may not appear in the listing for ~1-2s after the session goes terminal. The adapter retries the listing up to 5 times at 1s intervals so a single empty response doesn’t drop a real file.

Providers

Built-in: To add a provider, implement the ManagedAgentProvider protocol (start_session, poll_session, list_session_files, download_file) and wire it into ntro/workflow/agents/_config.py.

Register agents

Registration lifecycle (build → register → reference).

Claude Managed Agents

End-to-end walkthrough for the Anthropic adapter.

ntro.ingest

insert_submitted_document — the persistence function invoke uses.

Build runbooks

The runbook-side of invoke, inside a @runbook.step method.