25 Commits

Author SHA1 Message Date
Kazuhiro Sera 2231eb5d40 fix: reject schemas that exceed safe recursion depth (#4358) 2026-08-11 01:18:01 +00:00
Kazuhiro Sera c761dd602c fix: keep FunctionTool subclasses copyable (#4311)
Co-authored-by: LeSingh1 <sshaurya914@gmail.com>
2026-08-08 22:32:12 +00:00
Kazuhiro Sera 7de6ccf05d fix(schema): normalize typeless strict object schemas (#4139)
Co-authored-by: Rajarshi Datta <138959719+rajarshidattapy@users.noreply.github.com>
2026-08-03 04:36:25 +00:00
Henry Su e75cdd2e2c fix: cancel sibling enablement checks on failure (#4005) 2026-07-29 14:42:30 +09:00
Kazuhiro Sera 6eb779d939 fix: support async callable objects as function tools (#3949) 2026-07-26 08:06:43 +09:00
Shaurya Singh 813a00324e fix: redact invalid JSON payload in ModelBehaviorError data (#3485) 2026-05-21 23:54:12 +00:00
Illia Oleksiuk 7865ec9819 fix: avoid mutating FunctionTool params_json_schema (#3382) 2026-05-14 12:48:57 +09:00
Illia Oleksiuk 3a11cf5225 fix: reject non-object function tool input JSON (#3166) 2026-05-07 14:41:38 +09:00
Steve Coffey 2d665c9a67 Sandbox Agents (#2889)
### Sandbox Agents

This release adds **Sandbox Agents**, a beta SDK surface for running
agents with a persistent, isolated workspace. Sandbox agents keep the
normal `Agent` and `Runner` flow, but add workspace manifests,
sandbox-native capabilities, sandbox clients, snapshots, and resume
support so agents can work over real files, run commands, edit
repositories, generate artifacts, and continue work across runs.

Key pieces:

- `SandboxAgent`: an `Agent` with sandbox defaults such as
`default_manifest`, sandbox instructions, capabilities, and `run_as`.
- `Manifest`: a fresh-workspace contract for files, directories, local
files, local directories, Git repos, environment, users, groups, and
mounts.
- `SandboxRunConfig`: per-run sandbox wiring for client creation, live
session injection, serialized session resume, manifest overrides,
snapshots, and materialization concurrency limits.
- Built-in capabilities for shell access, filesystem editing and image
inspection, skills, memory, and compaction.
- Workspace snapshots and serialized sandbox session state for
reconnecting to existing work or seeding a fresh sandbox from saved
contents.

### Sandbox clients and hosted providers

Sandbox agents now support local, containerized, and hosted execution
backends:

- `UnixLocalSandboxClient` for fast local development.
- `DockerSandboxClient` for container isolation and image parity.
- Hosted sandbox clients for Blaxel, Cloudflare, Daytona, E2B, Modal,
Runloop, and Vercel through optional extras.

The release also adds provider-specific examples and mount strategies
for common storage backends, including S3, Cloudflare R2, Google Cloud
Storage, Azure Blob Storage, and S3 Files where supported by the
selected backend.

### Sandbox memory

Adds a sandbox memory capability that lets future sandbox-agent runs
learn from prior runs. Memory stores extracted lessons in the sandbox
workspace, injects a concise summary into later runs, and uses
progressive disclosure so agents can search deeper rollout summaries
only when useful.

Memory supports:

- Read-only or generate-only modes.
- Live updates when the agent discovers stale memory.
- Multi-turn grouping through `conversation_id`, SDK `Session`,
`RunConfig.group_id`, or generated run IDs.
- Separate memory layouts for isolating memory across agents or
workflows.
- S3-backed examples for persisted memory across runs.

### Workspace mounts, snapshots, and resume

This release adds a full workspace entry and mount model for sandbox
sessions:

- Local files and directories.
- Synthetic files and directories.
- Git repository entries.
- Remote storage mounts for S3, R2, GCS, Azure Blob Storage, and S3
Files.
- Provider-specific mount strategies across Docker, Modal, Cloudflare,
Blaxel, Daytona, E2B, and Runloop.
- Portable snapshots with path normalization, symlink preservation,
mount-safe snapshotting, and remote snapshot support.
- Resume paths through runner-managed `RunState`, explicit
`SandboxSessionState`, or saved snapshots.

### Examples and tutorials

Adds a large `examples/sandbox/` suite covering:

- Local Unix and Docker sandbox runners.
- Docker mount smoke tests for S3, GCS, Azure Blob Storage, and S3
Files.
- Sandbox coding tasks with skills.
- Sandbox agents as tools and handoff patterns.
- Memory examples, including multi-agent/multi-turn memory and S3-backed
memory.
- Tax-prep and healthcare-support workflows.
- Dataroom QA and metric extraction tutorials.
- Repository code review tutorial.
- Vision website clone tutorial.
- Provider examples for Blaxel, Cloudflare, Daytona, E2B, Modal,
Runloop, Temporal, and Vercel.

### Runtime, tracing, and model plumbing

The release includes the runtime plumbing needed to make sandbox agents
work naturally inside the existing SDK:

- Runner-managed sandbox preparation, capability binding, session
lifecycle, state serialization, and resume behavior.
- Sandbox-aware `RunState` serialization.
- Unified sandbox tracing with SDK spans.
- Token usage on tracing spans.
- Runner-managed prompt cache key defaults.
- OpenAI agent registration and harness ID configuration.
- Safer redaction of sensitive MCP tool outputs when sensitive tracing
is disabled.
- Additional OpenAI client/model utilities and Chat Completions
coverage.


## Documentation & Other Changes

- docs: add Asqav to external tracing processors list.
- docs: update translated document pages.

Co-authored-by: Abdulrahman Alfozan <alfozan@openai.com>
Co-authored-by: Aditya Singh <60082699+adityasingh2400@users.noreply.github.com>
Co-authored-by: Andi Liu <andi@openai.com>
Co-authored-by: Aron <263346377+aron-cf@users.noreply.github.com>
Co-authored-by: ashwinnathan-openai <ashwinnathan@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: cploujoux <cploujoux@blaxel.ai>
Co-authored-by: elainegan-openai <168589666+elainegan-openai@users.noreply.github.com>
Co-authored-by: Elias Freider <freider@users.noreply.github.com>
Co-authored-by: Erik Dunteman <erik@erikds-macbook-air.local>
Co-authored-by: Jason Liu <jasonliu@openai.com>
Co-authored-by: Jason Steving <32336750+jasonsteving99@users.noreply.github.com>
Co-authored-by: Kazuhiro Sera <seratch@openai.com>
Co-authored-by: Lovre Pešut <lovre.pesut@gmail.com>
Co-authored-by: Lucas Wang <lucas_wang@lucas-futures.com>
Co-authored-by: Matt Brockman <matt.brockman@e2b.dev>
Co-authored-by: Mish Ushakov <mishushakov@users.noreply.github.com>
Co-authored-by: Naresh <ghostwriternr@gmail.com>
Co-authored-by: nicholasclark-openai <nicholasclark@openai.com>
Co-authored-by: qiyaoq-oai <qiyaoq@openai.com>
Co-authored-by: Scott Trinh <scott@scotttrinh.com>
Co-authored-by: tode-rl <tony@runloop.ai>
Co-authored-by: Wendy Jiao <wendyjiao@openai.com>
2026-04-15 10:00:40 -07:00
Kazuhiro Sera 9ac31ab49f feat: add Responses API tool search support (#2610) 2026-03-06 19:23:38 +09:00
Kazuhiro Sera 933a3a93d7 fix: isolate parallel function tool failures (#2584) 2026-03-04 05:37:10 +09:00
Kazuhiro Sera 069f126490 feat: #2346 add configurable timeout handling for function tools (#2479) 2026-02-13 14:02:09 -08:00
weiguang li 85e56167f7 fix(tool): resolve default failure handler at invoke time (#2460) 2026-02-10 14:16:00 -08:00
Kazuhiro Sera 9a1543a238 fix: #2386 offload sync tool execution to worker threads (#2387) 2026-02-03 12:28:49 +09:00
Kazuhiro Sera 718a99e1e0 feat: Add tool guardrails to function_tool decorator args (ref #2218) (#2227) 2026-01-06 11:19:48 +09:00
Dominik Kundel 767cc00c9f Add new tools for gpt-5.1 (#2079)
Co-authored-by: Kazuhiro Sera <seratch@openai.com>
2025-11-13 09:55:29 -08:00
Wen-Tien Chang 5e1db14da5 Add tool call arguments in ToolContext for RunHooks (#1765)
## Background 

Currently, the `RunHooks` lifecycle (`on_tool_start`, `on_tool_end`)
exposes the `Tool` and `ToolContext`, but does not include the actual
arguments passed to the tool call.

resolves https://github.com/openai/openai-agents-python/issues/939

## Solution

This implementation is inspired by [PR
#1598](https://github.com/openai/openai-agents-python/pull/1598).

* Add a new `tool_arguments` field to `ToolContext` and populate it via
from_agent_context with tool_call.arguments.
* Update `lifecycle_example.py` to demonstrate tool_arguments in hooks
* Unlike the proposal in [PR
#253](https://github.com/openai/openai-agents-python/issues/253), this
solution is not expected to introduce breaking changes, making it easier
to adopt.
2025-09-22 19:05:23 -04:00
Viraj 72d0d75348 Retry: Add tool_name to ToolContext for generic tool handlers (#1110)
This is a follow-up to pr #1043 The original changes were reverted due
to missing updates in RealtimeSession, which caused runtime test
failures.

This PR:

- Reapplies the `tool_name` and `tool_call_id` additions to
`ToolContext`.
- Updates `RealtimeSession._handle_tool_call` to instantiate
`ToolContext` with `tool_name=event.name` and
`tool_call_id=event.call_id`.
- Adjusts tests as needed so that all 533 tests (including old-version
Python 3.9) pass cleanly.

Closes #1030

---------

Co-authored-by: Kazuhiro Sera <seratch@openai.com>
2025-07-15 11:37:38 -04:00
Rohan Mehta bbcf039d6d Back out "enhancement: Add tool_name to ToolContext to support shared tool handlers (#1043)" (#1105)
Original commit changeset: befe19db27

causing test failures, so reverting
2025-07-14 12:58:43 -04:00
Viraj befe19db27 enhancement: Add tool_name to ToolContext to support shared tool handlers (#1043)
This adds a `tool_name` field to `ToolContext`, which gets passed into
the `on_invoke_tool` handler. Helpful for scenarios where we dynamically
register multiple tools that all share a single generic handler e.g.in
multi-agent setups.

As such, by including the name of the tool that was invoked, the handler
can now easily branch logic or route requests accordingly.

Resolves  #1030 

All tests pass. and here is a script to test it out
https://gist.github.com/vrtnis/ca354244f7a5ecd9a73c0a2d34cb194b

---------

Co-authored-by: Kazuhiro Sera <seratch@openai.com>
2025-07-14 11:06:30 -04:00
Rohan Mehta e5d3ad7b99 [1/n] Break Agent into AgentBase+Agent (#1068)
This allows base agent stuff to be shared with the realtime agent
2025-07-11 12:11:26 -04:00
Niv Hertz 8dfd6ff35c Added support for passing tool_call_id via the RunContextWrapper (#766)
This PR fixes issue:
https://github.com/openai/openai-agents-python/issues/559

By adding the tool_call_id to the RunContextWrapper prior to calling
tools. This gives the ability to access the tool_call_id in the
implementation of the tool.
2025-06-09 11:08:50 -04:00
Rohan Mehta 4046fcb3fa Add is_enabled to FunctionTool (#808)
### Summary:
Allows a user to do `function_tool(is_enabled=<some_callable>)`; the
callable is called when the agent runs.

This allows you to dynamically enable/disable a tool based on the
context/env.

The meta-goal is to allow `Agent` to be effectively immutable. That
enables some nice things down the line, and this allows you to
dynamically modify the tools list without mutating the agent.

### Test Plan:
Unit tests
2025-06-03 13:44:16 -04:00
Rohan Mehta 10aa5555af Introduce tool_use_behavior on agents 2025-03-18 21:55:12 -04:00
Rohan Mehta aaec57a426 Initial commit 2025-03-11 09:42:28 -07:00