What you stop maintaining
The deeper shift: your loop’s state was trapped in process memory. On Checkfu the state is the log, so anything your loop did implicitly (retries, resume, audit, cost tracking) becomes a platform property you read instead of code you own.
The loop, before and after
Before, the shape of every hand-rolled agent:CHECKFU_API_KEY and CHECKFU_WORKSPACE_ID come from Get access.
requires_action session.status_idle is your ordinary “done” signal, and it lives in the log rather than on the connection, so a process that dies before reading it finds it waiting on restart. An idle event with stop_reason: "requires_action" is an intermediate Run boundary; keep following so you do not miss the admitted continuation. Idle ends a turn, not the Session; the settlement table covers the terminal statuses and continuation case.
The loop body did not move into a replacement in your code. It moved into the harness, which you pick per agent: managed Claude Agent or Codex, a packaged image, or your own ACP binary (see Harnesses and models). Your code’s job shrinks to three things: start sessions, send messages, and react to events.
Concept mapping for things your loop had names for
Migration order that works
- Lift the definition. Port your system prompt and model choice into an Agent, publish v1, and run it with the quickstart flow. No tools yet.
- Move the tools. One Connection at a time, under the default policy (reads allowed, writes require approval). Your riskiest tool goes last, once you trust the approval flow.
- Delete the loop. Swap your entry point to create-session-and-drive, keeping your old loop behind a flag until the event stream feels boring.
- Adopt what your loop never had. Per-user Budgets, webhooks instead of polling, and exports for compliance.
Next steps
Run your first session
The 10-minute version of steps 1 and 3.
Add an agent to your app
Embedding on a surface your users already use.