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.

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.

  1. 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.

  2. 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.

  3. 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.

  4. 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.

  5. 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.

  6. 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.

Use application functions or service-origin remote MCP without a workspace. Built-in shell and environment-local capabilities are absent.

Product interfaceApplication serverManaged harness

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

OpenAI-managed

Harness and durable agent resources

Your services & providers

Business tools, data, and optional compute

Application server

Authenticate users, submit input, handle function calls, and return results.

  • Product interface Application serverTask input →; authorized progress and results ←
  • Application server Managed harnessSession input and tool results →; progress and required actions ←
  • Inbox & worker Application serverRecheck session and dispatch pending work
  • Application server Function handlersValidated function call →; business result ←
Explore this component
Read all 8 connections
  • Product interfaceApplication serverTask input →; authorized progress and results ←
  • Application serverManaged harnessSession input and tool results →; progress and required actions ←
  • Managed harnessSessions & saved workConversation and work retained as managed state
  • Managed harnessInbox & workerOptional signed notification → durable acceptance
  • Inbox & workerApplication serverRecheck session and dispatch pending work
  • Application serverFunction handlersValidated function call →; business result ←
  • Function handlersBusiness dataAuthorized query or write →; scoped data ←
  • Managed harnessRemote MCP serviceRemote 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.

Stage 1 of 5: Read an order

Where is ORDER-100?

  1. User
  2. App
  3. Harness
  4. lookup_order
  5. 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 · 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
  1. 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.

  2. 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.

  3. 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.

  4. 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 ↗

Turn the model into a working integration.

Run a local example, or use the encyclopedia to explore a specific boundary.

Build the order example Browse all topics