Skip to main content
Use this recipe when you want more than a one-shot text request:
  • multi-step tool loops
  • local runtime tools
  • resumable runs
  • a single gateway-backed entrypoint for agent work

1. Install the SDKs

2. Define one small runtime tool

Keep the first tool deterministic and easy to inspect.

3. Create the agent

4. Use the gateway-backed adapter

5. What persists between steps

Each completed step updates returned run state with:
  • the run id
  • the message history
  • any returned tool calls
  • any local tool results
  • the final output when the run completes
If you want resumability across requests or processes, persist that returned value in your own application and pass it back into continueRun() later.

6. When to keep the first version simple

  • one agent per workflow
  • application-owned serialization before any cross-request resume flow
  • a small tool list before generic tool registries
  • one log line per run with the run id and gateway request id

7. When to move beyond this recipe

Move past the first durable loop when you need:
  • approval pauses
  • application-owned persistence for returned run state
  • multiple agent definitions with shared runtime tools
At that point, keep the same gateway-backed adapter and evolve the store and orchestration around it.
Last modified on July 26, 2026