Runs
A turn runs from your message to the agent's answer. These pages show the ways your program can start a turn, follow it, and answer what it asks.
Choose how to run a turn
Pick the page that matches what your program does:
One call: agent.run()
Do one task with no follow-up, and read how it ended.
Step through a session
Send several messages to one session, or step a turn through its approvals.
Build a session app
Watch a session from a view, and send it a person's messages, approvals, steers, and interrupts.
Callbacks
Answer the approvals, client tool calls, and sign-ins a turn waits for.
Choose agent.run() or a session
Use agent.run() for one task with no follow-up. It starts a session, runs one turn, and returns the turn's record. Start a session when you send more than one message, or when another process watches or answers the turn.
Callbacks work with run() and in a session app. Use functions such as on_approval= when your program can decide. When a person or another process decides, leave the callback open and answer it by id.