FROM CONCEPTS TO A WORKING SYSTEM Understand the whole agent system. Follow the request, identify who owns each responsibility, and see what changes when a task needs tools, approvals, or recovery.
Learning path Architecture explorer Order assistant Task lifecycle lab 01 / LEARNING PATH Six questions, one connected system. Start with the prerequisites, read the linked guides, then check whether you can explain the boundary in your own words.
01 Choose the right kind of agent Before you begin: Start here; no agent experience required.
You will be able to: Explain when you need a tool-using workflow and who should own its orchestration.
Check your understanding: Does every model request need an Agents API session? No. A focused model request may use Responses directly. Choose a managed session when the workload benefits from the managed harness and durable work.
02 Separate resources and their lifetimes Before you begin: Understand runtime ownership from step 1.
You will be able to: Distinguish configuration, conversation, one turn of work, and the machine executing commands.
Check your understanding: Does deleting a session shut down your self-hosted machine? No. Your application releases provider compute separately and preserves needed files before cleanup.
03 Connect tools across trust boundaries Before you begin: Know which application owns the session.
You will be able to: Choose functions, MCP, or environment capabilities and put credentials in the correct place.
Check your understanding: Can a tool argument establish the user's identity? No. Authenticate the user outside the model and authorize each tool operation against that server-owned identity.
04 Run one complete request Before you begin: Read the function-call contract; API access is needed only to execute the examples.
You will be able to: Create a session, handle a tool request, return a result, and recognize the root turn outcome.
Check your understanding: Is an idle event enough to show success? No. Check the root turn's terminal outcome, then inspect its output and tool results.
05 Make work safe and recoverable Before you begin: Understand the successful tool loop from step 4.
You will be able to: Add approvals, durable delivery, and recovery without repeating a business action.
Check your understanding: Does deduplicating a webhook prevent every duplicate refund? No. Delivery IDs and business-operation IDs solve different problems. Reconcile downstream effects and enforce operation-level idempotency.
06 Measure whether the agent is good enough Before you begin: Define the user outcome and unacceptable actions.
You will be able to: Compare configurations using task success, unsafe actions, latency, and total cost.
Check your understanding: Should you add subagents because a task is slow? Not automatically. Inspect the bottleneck and compare a representative workload; delegation adds coordination and cost as well as potential parallelism.
02 / ARCHITECTURE EXPLORER One harness. Different execution choices. Switch the environment, then inspect responsibilities, stored data, and credential boundaries. Optional components are choices for your workload, not an installation checklist.
No environment OpenAI-hosted Self-hosted compute
Use application functions or service-origin remote MCP without a workspace. Built-in shell and environment-local capabilities are absent.
Product interface ⇄ Application server ⇄ Managed harness
Responsibilities Data & state Credentials & access
Select a component to trace its connections. A solid border marks your selection; dashed borders mark connected components.
Your application Identity, product behavior, and delivery
User-facing layer Product interface Collect a task and show progress, approval prompts, and results. Application responsibility Application server Authenticate users, submit input, handle function calls, and return results. Optional delivery architecture Inbox & worker Durably accept notifications and perform work after the original HTTP request ends. OpenAI-managed Harness and durable agent resources
Managed runtime Managed harness Coordinates model calls, tool use, context handling, and the turn's work. Managed resources Sessions & saved work Retain conversation and work across turns; expose events and saved items. Your services & providers Business tools, data, and optional compute
When functions are used Function handlers Validate arguments and execute application logic; submit the matching tool result. Workload-dependent Business data Orders, policies, and other product data accessed through authorized tools. Optional tool interface Remote MCP service Expose remote tools to the harness. This diagram shows service-origin remote MCP. Application server Authenticate users, submit input, handle function calls, and return results.
Product interface → Application server Task input →; authorized progress and results ← Application server → Managed harness Session input and tool results →; progress and required actions ← Inbox & worker → Application server Recheck session and dispatch pending work Application server → Function handlers Validated function call →; business result ← Explore this component Read all 8 connections Product interface → Application server Task input →; authorized progress and results ← Application server → Managed harness Session input and tool results →; progress and required actions ← Managed harness → Sessions & saved work Conversation and work retained as managed state Managed harness → Inbox & worker Optional signed notification → durable acceptance Inbox & worker → Application server Recheck session and dispatch pending work Application server → Function handlers Validated function call →; business result ← Function handlers → Business data Authorized query or write →; scoped data ← Managed harness → Remote MCP service Remote tool request →; tool output ← Reference: OpenAI Agents API architecture ↗
03 / A CONNECTED CASE STUDY Build out an order assistant, one requirement at a time. Start with the downloadable read-only example, then follow the architecture decisions for policy answers, approved refunds, durable delivery, and evaluation. These are illustrated workflows; the explorer does not execute orders or payments.
1. Read an order 2. Explain policy 3. Approve a refund 4. Survive disconnection 5. Evaluate and operate
Stage 1 of 5: Read an order
“Where is ORDER-100?” User App Harness lookup_order Order database What changes One ownership-scoped function The answer depends on customer data, so a model-only answer is insufficient. A read-only function can look up the authorized order without a sandbox.
The boundary to preserve The model supplies an order ID. The server supplies identity and returns only the permitted status fields.
Prove it works A request for another customer's order returns no order data.
04 / TASK LIFECYCLE LAB The same task can end in very different ways. Select a scenario and walk through it. Compare the user-visible status, your application's responsibility, and the actual API signal. This is an explanatory trace, not a live session.
Successful lookup Approval denied Tool failure Lost browser stream Duplicate webhook Compute unavailable Task cancelled
1 Accept an authorized task2 A tool result is required3 Return authorized data4 Confirm the root outcomeSuccessful lookup · Step 1 of 4
Accept an authorized task User interface Submitting the order request.
Application responsibility Authenticate the user and store the job-to-session association.
API signal / observation Create a session with initial input; watch its events.
Keep the distinction: Root completion plus valid tool output establishes this task's result; idle alone does not.
Read the implementation guide Read the complete scenario Accept an authorized task UI: Submitting the order request.
Application: Authenticate the user and store the job-to-session association.
API: Create a session with initial input; watch its events.
A tool result is required UI: Checking the order…
Application: Retrieve current required_actions and validate the pending function call.
API: Stream: agent.session.requires_action. Read turn_id and call_id from the action.
Return authorized data UI: Order found; preparing the answer.
Application: Check order ownership and return serialized status data.
API: Submit agent.session.input.tool_result with success: true and matching IDs.
Confirm the root outcome UI: Your order has shipped.
Application: Inspect output and tool results; store the business outcome.
API: Root agent.session.turn.completed. Final text may arrive without deltas.
References: Events and items ↗ · Sandbox lifecycle ↗ · Function results ↗