Skip to main content

Handle multi-step workflows

A multi-step session workflow follows this pattern: the agent pays once (first request), receives a session ID, then makes as many subsequent requests as needed — all sharing the same vault and accumulating results.

The two-request pattern

Step 1 — First request (pays, creates session):
Response:
The agent saves vaultId and sessionId for subsequent requests. Step 2 — Subsequent request (no payment):
Response:
The vaultId is identical to Step 1 — the same vault. Both steps’ documents are in it.

Confirming vault accumulation

After all steps complete, verify that the vault contains all accumulated results:
Response:
Both documents from both steps are present in the single vault.

Full TypeScript example

What the vault contains after all steps