49 Commits

Author SHA1 Message Date
Kazuhiro Sera 21c88f582c docs: improve the consistency of docs 2026-08-01 11:37:59 +09:00
Kazuhiro Sera 606fbd0d8a docs: clarify sandbox support on Windows (#3866) 2026-07-17 12:39:11 +00:00
Kazuhiro Sera 6bb69bc2d4 docs: update readme 2026-07-09 20:12:11 +09:00
Kazuhiro Sera 163caa3aa8 docs: update README 2026-07-08 08:47:08 +09:00
Kazuhiro Sera 0ffb9e062c docs: update README.md 2026-07-06 15:41:39 +09:00
Kazuhiro Sera e3746c52d9 docs: updates for v0.17.0 (#3188) 2026-05-08 17:10:34 +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 570b114770 docs: update readme 2026-03-26 20:52:17 +09:00
teri-oai 230a9d6759 Highlight gpt-realtime-1.5 in public docs (#2724)
**Default guidance in public documentation**
https://openai.github.io/openai-agents-python/

**Before**
The public Agents SDK docs still mostly pointed realtime users at
gpt-realtime, so new users were landing on stale guidance instead of the
recommended gpt-realtime-1.5 path. This showed up in the top-level docs
entry points and the English realtime quickstart/guide.

**After**
The public documentation now points new realtime users to
gpt-realtime-1.5 in the top-level discovery pages and the English
realtime quickstart/guide. The SDK’s implicit runtime default was
intentionally left unchanged, so this updates guidance without changing
behavior for existing integrations that omit model_name.
2026-03-19 15:17:40 -07:00
Kazuhiro Sera 6b90ab3ac6 docs: update README.md 2026-03-02 15:05:40 +09:00
Kazuhiro Sera 2b32271df9 Update README.md to be more user-friendly 2026-03-02 09:44:12 +09:00
layla 43b63dcd8f Fix docs: change http to https in tracing links (#2572) 2026-03-01 22:00:58 +09:00
Kazuhiro Sera b6b291f684 chore: drop Python 3.9 support across metadata, CI, and docs (#2474) 2026-02-13 11:39:12 -08:00
Giselle van Dongen 15cab802b3 Add OpenAI Agents SDK + Restate integration to the docs (#2359)
Co-authored-by: Kazuhiro Sera <seratch@openai.com>
2026-01-23 22:47:16 +09:00
Zach Parent 93740fa49c Fix README.md typo in uv installation instructions (#2210) 2025-12-20 08:14:46 +09:00
Kazuhiro Sera 7b752dcf62 Update README.md 2025-12-02 10:33:15 +09:00
Filinto Duran 763048f905 Add Dapr session storage option (#1937) 2025-11-05 14:22:07 +09:00
Kazuhiro Sera e1f267588f Add a link to PyPI project URL on README.md 2025-10-22 10:08:47 +09:00
Damian ONeill 503a6ea7a5 feat: add Redis session support for scalable distributed memory (#1785)
Co-authored-by: Kazuhiro Sera <seratch@openai.com>
2025-09-25 14:03:06 +09:00
Kazuhiro Sera 7222a84ef6 Imrpove "Getting Started" on README (#1516) 2025-08-18 17:32:14 +09:00
Rohan Mehta ef812c5eda Add temporal demo to docs (#1310) 2025-07-30 12:08:55 -04:00
Cole McIntosh 44042e165a Add LiteLLM to acknowledgements section (#1240)
## Summary
- Added LiteLLM to the acknowledgements section in README.md
- Recognized LiteLLM as a unified interface for 100+ LLMs, which aligns
with the SDK's provider-agnostic approach

## Test plan
- [x] Verify README renders correctly
- [x] Ensure link to LiteLLM repository is functional
2025-07-25 00:22:40 +00:00
Rohan Mehta 6cb9639cd2 Realtime: make sure we use the initial model settings (#1198)
Made a mistake here - we were ignoring the settings passed into the
Runner init., and only usig the override settings passed to run()
2025-07-21 12:57:53 -04:00
Stephan Fitzpatrick 6b94ad0f85 Add Sessions for Automatic Conversation History Management (#752)
# Overview

Resolves #745

This PR introduces **Sessions**, a new core feature that automatically
maintains conversation history across multiple agent runs, eliminating
the need to manually handle `.to_input_list()` between turns.

## Key Features

### 🧠 Automatic Memory Management
- **Zero-effort conversation continuity**: Agents automatically remember
previous context without manual state management
- **Session-based organization**: Each conversation is isolated by
unique session IDs
- **Seamless integration**: Works with existing `Runner.run()`,
`Runner.run_sync()`, and `Runner.run_streamed()` methods

### 🔌 Extensible Session Protocol
- **Library-agnostic design**: Clean protocol interface allows any
storage backend
- **Drop-in implementations**: Easy integration with Redis, PostgreSQL,
MongoDB, or any custom storage
- **Production-ready interface**: Async-first design with proper error
handling and type safety
- **Vendor flexibility**: Library authors can provide their own Session
implementations

### 💾 Built-in SQLite Implementation
- **In-memory SQLite**: Perfect for temporary conversations during
development
- **Persistent SQLite**: File-based storage for conversations that
survive application restarts
- **Thread-safe operations**: Production-ready with connection pooling
and proper concurrency handling

### 🔧 Simple API
```python
# Before: Manual conversation management
result1 = await Runner.run(agent, "What's the weather?")
new_input = result1.to_input_list() + [{"role": "user", "content": "How about tomorrow?"}]
result2 = await Runner.run(agent, new_input)

# After: Automatic with Sessions
session = SQLiteSession("user_123")

result1 = await Runner.run(agent, "What's the weather?", session=session)
result2 = await Runner.run(agent, "How about tomorrow?", session=session)  # Remembers context automatically
```

## What's Included

### Core Session Protocol
- **`Session` Protocol**: Clean, async interface that any storage
backend can implement
- **Type-safe design**: Full type hints and runtime validation
- **Standard operations**: `get_items()`, `add_items()`, `pop_item()`,
`clear_session()`
- **Extensibility-first**: Designed for third-party implementations

### Reference Implementation
- **`SQLiteSession` Class**: Production-ready SQLite implementation
- **Automatic schema management**: Creates tables and indexes
automatically
- **Connection pooling**: Thread-safe operations with proper resource
management
- **Flexible storage**: In-memory or persistent file-based databases

### Runner Integration
- **New `session` parameter**: Drop-in addition to existing `Runner`
methods
- **Backward compatibility**: Zero breaking changes to existing code
- **Automatic history management**: Prepends conversation history before
each run

## Session Protocol for Library Authors

The Session protocol provides a clean interface for implementing custom
storage backends:

```python
from agents.memory import Session
from typing import List

class MyCustomSession:
    """Custom session implementation following the Session protocol."""

    def __init__(self, session_id: str):
        self.session_id = session_id
        # Your initialization here

    async def get_items(self, limit: int | None = None) -> List[dict]:
        """Retrieve conversation history for this session."""
        # Your implementation here
        pass

    async def add_items(self, items: List[dict]) -> None:
        """Store new items for this session."""
        # Your implementation here
        pass

    async def pop_item(self) -> dict | None:
        """Remove and return the most recent item from this session."""
        # Your implementation here
        pass

    async def clear_session(self) -> None:
        """Clear all items for this session."""
        # Your implementation here
        pass

# Works seamlessly with any custom implementation
result = await Runner.run(agent, "Hello", session=MyCustomSession("session_123"))
```

### Example Third-Party Implementations

```python
# Redis-based session (hypothetical library implementation)
from redis_sessions import RedisSession
session = RedisSession("user_123", redis_url="redis://localhost:6379")

# PostgreSQL-based session (hypothetical library implementation) 
from postgres_sessions import PostgreSQLSession
session = PostgreSQLSession("user_123", connection_string="postgresql://...")

# Cloud-based session (hypothetical library implementation)
from cloud_sessions import CloudSession
session = CloudSession("user_123", api_key="...", region="us-east-1")

# All work identically with the Runner
result = await Runner.run(agent, "Hello", session=session)
```

## Benefits

### For Application Developers
- **Reduces boilerplate**: No more manual `.to_input_list()` management
- **Prevents memory leaks**: Automatic cleanup and organized storage
- **Easier debugging**: Clear conversation history tracking
- **Flexible storage**: Choose the right backend for your needs

### For Library Authors
- **Clean integration**: Simple protocol to implement for any storage
backend
- **Type safety**: Full type hints and runtime validation
- **Async-first**: Modern async/await design throughout
- **Documentation**: Comprehensive examples and API reference

### For Applications
- **Better user experience**: Seamless conversation continuity
- **Scalable architecture**: Support for multiple concurrent
conversations
- **Flexible deployment**: In-memory for development, production storage
for scale
- **Multi-agent support**: Same conversation history can be shared
across different agents

## Usage Examples

### Basic Usage with SQLiteSession
```python
from agents import Agent, Runner, SQLiteSession

agent = Agent(name="Assistant", instructions="Reply concisely.")
session = SQLiteSession("conversation_123")

# Conversation flows naturally
await Runner.run(agent, "Hi, I'm planning a trip to Japan", session=session)
await Runner.run(agent, "What's the best time to visit?", session=session)
await Runner.run(agent, "How about cherry blossom season?", session=session)
```

### Multiple Sessions with Isolation
```python
# Different users get separate conversation histories
session_alice = SQLiteSession("user_alice")
session_bob = SQLiteSession("user_bob")

# Completely isolated conversations
await Runner.run(agent, "I like pizza", session=session_alice)
await Runner.run(agent, "I like sushi", session=session_bob)
```

### Persistent vs In-Memory Storage
```python
# In-memory database (lost when process ends)
session = SQLiteSession("user_123")

# Persistent file-based database
session = SQLiteSession("user_123", "conversations.db")
```

### Session Management Operations
```python
session = SQLiteSession("user_123")

# Get all items in a session
items = await session.get_items()

# Add new items to a session
new_items = [
    {"role": "user", "content": "Hello"},
    {"role": "assistant", "content": "Hi there!"}
]
await session.add_items(new_items)

# Remove and return the most recent item (useful for corrections)
last_item = await session.pop_item()

# Clear all items from a session
await session.clear_session()
```

### Message Correction Pattern
```python
# User wants to correct their last question
user_message = await session.pop_item()  # Remove user's question
assistant_message = await session.pop_item()  # Remove agent's response

# Ask a corrected question
result = await Runner.run(
    agent,
    "What's 2 + 3?",  # Corrected question
    session=session
)
```

## Technical Details

### Session Protocol Design
- **Async-first**: All operations are async for non-blocking I/O
- **Type-safe**: Full type hints with runtime validation
- **Error handling**: Graceful degradation and detailed error messages
- **Resource management**: Proper cleanup and connection handling

### SQLiteSession Implementation
- **Thread-safe operations** with connection pooling
- **Automatic schema management** with proper indexing
- **JSON serialization** for message storage
- **Memory-efficient** conversation retrieval and storage
- **Cross-platform compatibility**

## Breaking Changes

None. This is a purely additive feature that doesn't affect existing
functionality.

## Documentation

- Updated core concepts in `docs/index.md` to highlight Sessions as a
key primitive
- New comprehensive guide at `docs/sessions.md` with protocol
implementation examples
- Enhanced `docs/running_agents.md` with automatic vs manual
conversation management
- Full API reference integration via `docs/ref/memory.md`
- Implementation guide for library authors

Sessions represent a significant architectural improvement for building
conversational AI applications with the Agents SDK. The extensible
Session protocol enables the ecosystem to provide specialized storage
backends while maintaining a consistent, simple API for application
developers.

---------

Co-authored-by: Rohan Mehta <rm@openai.com>
2025-07-10 12:18:49 -04:00
Antoine Legrand 6358cd9525 Add Makefile check rule to run all the linters and checkers (#1038)
It adds a Makefile rule `check` to run all linters and checkers in a
single command.

With only `make check` instead of 3-4 commands, it can help to forget
one of them before pushing a PR.
2025-07-08 13:22:56 -04:00
CCM 0475450d59 replace .py file with .ipynb for Jupyter example (#262)
Co-authored-by: chenchaomin <chenchaomin@guazi.com>
2025-06-27 10:39:49 -04:00
Richard 271a1a4b97 Add uv as an alternative Python environment setup option for issue #884 (#909)
- Add Option A (venv) and Option B (uv) in Get started section
- Mark uv as recommended to align with development workflow
- Include Windows activation commands for both options
- Resolves #884
2025-06-27 10:33:08 -04:00
Rohan Mehta 05db7a68cd Crosslink to js/ts (#815) 2025-06-04 15:37:09 -04:00
Rohan Mehta 942ba9840b Docs and tests for litellm (#561) 2025-04-21 16:59:01 -04:00
Kazuhiro Sera 98c4b45b6a Make the optional dependency installation compatible with zsh 2025-03-21 10:01:24 +09:00
Rohan Mehta fb8e5c2baf v0.0.6 (voice support) 2025-03-20 13:10:54 -04:00
Dmitry Pimenov a43cf1542b clarifying that handoffs are a type of tool call under the hood 2025-03-17 15:05:15 -07:00
Rohan Mehta 1368e7ffe6 Update tracing docs 2025-03-17 14:57:43 -04:00
Dmitry Pimenov 3ef5f4712a Add Scorecard as supported external trace processors (#80)
Incredibly excited to add Scorecard as an external trace processor for
the Agents SDK!
2025-03-12 21:25:42 -07:00
Dare f8655c3b44 Merge branch 'main' into main 2025-03-12 17:24:39 -07:00
Dmitry Pimenov 536d7826d5 added a Jupyter example to clarify how to use the SDK with an existing event loop 2025-03-12 17:24:35 -07:00
Dmitry Pimenov 2f2e2fce5a adding Keywords AI as a trace processor 2025-03-12 13:15:53 -07:00
Dare 9952d2667e Adding link to docs on Scorecard AgentSDK Support
Incredibly excited to add support the agentsdk for Scorecard tracing!
2025-03-12 04:43:50 -07:00
Rohan Mehta c8f3cdd6c8 Merge pull request #13 from Jai0401/fix-typo-readme
fix: correct typo in README regarding tool responses
2025-03-11 23:25:05 -07:00
Ali Yaman fce4872f32 docs: Fix typos in documentation files 2025-03-12 00:12:31 +01:00
jhills20 bc6865659d tweaks to readme 2025-03-11 13:08:35 -07:00
jhills20 d6465aade8 fix typo 2025-03-11 12:37:40 -07:00
jhills20 b93857ba55 Add note on compatibility w other providers 2025-03-11 12:06:22 -07:00
Dmitry Pimenov 8d8183613a updating links/tracing description 2025-03-11 11:39:26 -07:00
Jai0401 c80c6ef185 fix: correct wording in README for clarity on response handling 2025-03-11 23:59:23 +05:30
Rohan Mehta 87cf0593ba link to documentation from readme 2025-03-11 11:29:22 -07:00
Jai0401 5b3a703ad9 fix: correct typo in README regarding tool responses 2025-03-11 23:53:45 +05:30
Dmitry Pimenov 3c7fef4230 updating screenshot to CDN link 2025-03-11 10:21:11 -07:00
Rohan Mehta aaec57a426 Initial commit 2025-03-11 09:42:28 -07:00