Skip to main content
Complex workflows that involve multiple dependent steps are a natural fit for Praxa missions. Rather than manually chaining model calls, managing intermediate state, and handling failures at each transition, you submit a single goal and let the Praxa Integration Gateway’s agent autonomously decompose and execute the work. You retain full observability through the event stream and can intervene at any point using signals or cancellation.

How Praxa Executes Multi-Step Workflows

When you submit a mission, the agent receives your goalSpec and plans a sequence of steps that it believes will achieve the goal within the declared resourceBudget. Each step is a traceable unit of work — the agent records what it did, what tool it called, and what result it received before advancing to the next step.
The maximumParallelism field in resourceBudget controls how many concurrent branches the agent may execute at once. Setting it above 1 allows the agent to research multiple competitors simultaneously, which can significantly reduce elapsed time for fan-out workflows.
Every step emitted during execution appears in mission.steps when you poll getMission(), giving you a running record of progress even before the workflow completes.

Sending Signals to a Running Mission

Signals let you inject data or instructions into a mission that is still in progress — for example, to provide a user’s choice, supply a value fetched from an external system, or redirect the agent’s focus.
The four arguments are: Here is a fuller example that waits until the mission reaches a waiting state before sending a signal:

Streaming Live Progress

The missionEvents() async generator yields every server-sent event emitted during the mission’s lifetime. Pipe these events to your front-end via WebSocket or SSE to give users a live view of agent progress.
Pass { lastEventId: savedId } as the second argument to missionEvents() to resume a stream from a known point after a connection drop. The gateway replays events from that ID forward.

Cancelling a Workflow

Call cancelMission() whenever you need to stop execution — user request, budget alert, or external policy trigger. The gateway records the cancellation durably and the agent terminates at the next safe checkpoint.
After cancellation is accepted, the event stream emits mission.cancelled and closes. If you have an active missionEvents() loop running, it will exit on its own once it receives the terminal event.
Cancellation is a durable request, not an instant kill signal. Steps that are already in flight may complete before the agent halts. Always wait for the mission.cancelled event before assuming execution has stopped.

Error Recovery

When a mission transitions to failed, the mission.failed event’s data field contains error details you can inspect to understand what went wrong. To retry the workflow, create a new mission with a fresh idempotency key.
The PraxaClient automatically retries transient HTTP errors (408, 425, 429, 500–504) on idempotent requests up to three times with exponential back-off. The error recovery pattern above is for handling missions that reach a terminal failed status at the application level, not HTTP transport failures.