docs: improve consistency

This commit is contained in:
Kazuhiro Sera
2026-03-03 09:43:47 +09:00
parent dde45fc9e6
commit c4a87ab887
10 changed files with 26 additions and 26 deletions
+1 -1
View File
@@ -300,7 +300,7 @@ agent = Agent(
)
```
## Tool Use Behavior
## Tool use behavior
The `tool_use_behavior` parameter in the `Agent` configuration controls how tool outputs are handled:
+1 -1
View File
@@ -12,7 +12,7 @@ If you pass plain `Agent` instances, their [`handoff_description`][agents.agent.
You can create a handoff using the [`handoff()`][agents.handoffs.handoff] function provided by the Agents SDK. This function allows you to specify the agent to hand off to, along with optional overrides and input filters.
### Basic Usage
### Basic usage
Here's how you can create a simple handoff:
+4 -4
View File
@@ -11,7 +11,7 @@ Realtime agents allow for conversational flows, processing audio and text inputs
## Architecture
### Core Components
### Core components
The realtime system consists of several key components:
@@ -64,9 +64,9 @@ Additional configuration options you can set on `RealtimeRunner(config=...)` inc
See [`RealtimeRunConfig`][agents.realtime.config.RealtimeRunConfig] and [`RealtimeSessionModelSettings`][agents.realtime.config.RealtimeSessionModelSettings] for the complete typed configuration.
## Tools and Functions
## Tools and functions
### Adding Tools
### Adding tools
Just like regular agents, realtime agents support function tools that execute during conversations:
@@ -94,7 +94,7 @@ agent = RealtimeAgent(
## Handoffs
### Creating Handoffs
### Creating handoffs
Handoffs allow transferring conversations between specialized agents.
+1 -1
View File
@@ -263,7 +263,7 @@ async def main():
# California
```
#### Automatic conversation management with Sessions
#### Automatic conversation management with sessions
For a simpler approach, you can use [Sessions](sessions/index.md) to automatically handle conversation history without manually calling `.to_input_list()`:
+2 -2
View File
@@ -1,4 +1,4 @@
# Advanced SQLite Sessions
# Advanced SQLite sessions
`AdvancedSQLiteSession` is an enhanced version of the basic `SQLiteSession` that provides advanced conversation management capabilities including conversation branching, detailed usage analytics, and structured conversation queries.
@@ -297,7 +297,7 @@ CREATE TABLE turn_usage (
Check out the [complete example](https://github.com/openai/openai-agents-python/tree/main/examples/memory/advanced_sqlite_session_example.py) for a comprehensive demonstration of all features.
## API Reference
## API reference
- [`AdvancedSQLiteSession`][agents.extensions.memory.advanced_sqlite_session.AdvancedSQLiteSession] - Main class
- [`Session`][agents.memory.session.Session] - Base session protocol
+3 -3
View File
@@ -1,4 +1,4 @@
# Encrypted Sessions
# Encrypted sessions
`EncryptedSession` provides transparent encryption for any session implementation, securing conversation data with automatic expiration of old items.
@@ -75,7 +75,7 @@ session = EncryptedSession(
)
```
### TTL (Time To Live)
### TTL (time to live)
Set how long encrypted items remain valid:
@@ -169,7 +169,7 @@ items = await session.get_items() # Only returns non-expired items
result = await Runner.run(agent, "Continue conversation", session=session)
```
## API Reference
## API reference
- [`EncryptedSession`][agents.extensions.memory.encrypt_session.EncryptedSession] - Main class
- [`Session`][agents.memory.session.Session] - Base session protocol
+1 -1
View File
@@ -619,7 +619,7 @@ The community has developed additional session implementations:
If you've built a session implementation, please feel free to submit a documentation PR to add it here!
## API Reference
## API reference
For detailed API documentation, see:
+2 -2
View File
@@ -1,4 +1,4 @@
# SQLAlchemy Sessions
# SQLAlchemy sessions
`SQLAlchemySession` uses SQLAlchemy to provide a production-ready session implementation, allowing you to use any database supported by SQLAlchemy (PostgreSQL, MySQL, SQLite, etc.) for session storage.
@@ -70,7 +70,7 @@ if __name__ == "__main__":
```
## API Reference
## API reference
- [`SQLAlchemySession`][agents.extensions.memory.sqlalchemy_session.SQLAlchemySession] - Main class
- [`Session`][agents.memory.session.Session] - Base session protocol
+2 -2
View File
@@ -85,11 +85,11 @@ class MyHooks(RunHooks):
print(f"{agent.name}{u.requests} requests, {u.total_tokens} total tokens")
```
## API Reference
## API reference
For detailed API documentation, see:
- [`Usage`][agents.usage.Usage] - Usage tracking data structure
- [`RequestUsage`][agents.usage.RequestUsage] - Per-request usage details
- [`RunContextWrapper`][agents.run.RunContextWrapper] - Access usage from run context
- [`RunHooks`][agents.run.RunHooks] - Hook into usage tracking lifecycle
- [`RunHooks`][agents.run.RunHooks] - Hook into usage tracking lifecycle
+9 -9
View File
@@ -1,4 +1,4 @@
# Agent Visualization
# Agent visualization
Agent visualization allows you to generate a structured graphical representation of agents and their relationships using **Graphviz**. This is useful for understanding how agents, tools, and handoffs interact within an application.
@@ -10,16 +10,16 @@ Install the optional `viz` dependency group:
pip install "openai-agents[viz]"
```
## Generating a Graph
## Generating a graph
You can generate an agent visualization using the `draw_graph` function. This function creates a directed graph where:
- **Agents** are represented as yellow boxes.
- **MCP Servers** are represented as grey boxes.
- **MCP servers** are represented as grey boxes.
- **Tools** are represented as green ellipses.
- **Handoffs** are directed edges from one agent to another.
### Example Usage
### Example usage
```python
import os
@@ -68,14 +68,14 @@ draw_graph(triage_agent)
This generates a graph that visually represents the structure of the **triage agent** and its connections to sub-agents and tools.
## Understanding the Visualization
## Understanding the visualization
The generated graph includes:
- A **start node** (`__start__`) indicating the entry point.
- Agents represented as **rectangles** with yellow fill.
- Tools represented as **ellipses** with green fill.
- MCP Servers represented as **rectangles** with grey fill.
- MCP servers represented as **rectangles** with grey fill.
- Directed edges indicating interactions:
- **Solid arrows** for agent-to-agent handoffs.
- **Dotted arrows** for tool invocations.
@@ -86,16 +86,16 @@ The generated graph includes:
`agents` package (verified in **v0.2.8**). If you dont see MCP boxes
in your visualization, upgrade to the latest release.
## Customizing the Graph
## Customizing the graph
### Showing the Graph
### Showing the graph
By default, `draw_graph` displays the graph inline. To show the graph in a separate window, write the following:
```python
draw_graph(triage_agent).view()
```
### Saving the Graph
### Saving the graph
By default, `draw_graph` displays the graph inline. To save it as a file, specify a filename:
```python