agent sdk/Building Autonomous Agents

Multi-Turn Tool Execution Loops

Architecting autonomous agents that execute tools in cycles.


The Agent Loop Pattern

1. Model evaluates prompt and returns `tool_calls`. 2. Your runtime executes local functions. 3. Results are appended as `role: "tool"` messages. 4. Call is repeated until `finish_reason: "stop"`.

Need an Unlocked AI Key or Credits?

Generate secret API keys backed by non-expiring pay-as-you-go credits starting at $5. No monthly minimums.