You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -17,125 +17,19 @@ The OpenAI Agents SDK is a lightweight yet powerful framework for building multi
17
17
18
18
Explore the [examples](examples) directory to see the SDK in action, and read our [documentation](https://openai.github.io/openai-agents-python/) for more details.
19
19
20
-
## Sessions
21
-
22
-
The Agents SDK provides built-in session memory to automatically maintain conversation history across multiple agent runs, eliminating the need to manually handle `.to_input_list()` between turns.
23
-
24
-
### Quick start
25
-
26
-
```python
27
-
from agents import Agent, Runner, SQLiteSession
28
-
29
-
# Create agent
30
-
agent = Agent(
31
-
name="Assistant",
32
-
instructions="Reply very concisely.",
33
-
)
34
-
35
-
# Create a session instance
36
-
session = SQLiteSession("conversation_123")
37
-
38
-
# First turn
39
-
result =await Runner.run(
40
-
agent,
41
-
"What city is the Golden Gate Bridge in?",
42
-
session=session
43
-
)
44
-
print(result.final_output) # "San Francisco"
45
-
46
-
# Second turn - agent automatically remembers previous context
# Remove and return the most recent item from the session
113
-
pass
114
-
115
-
asyncdefclear_session(self) -> None:
116
-
# Clear all items for the session
117
-
pass
118
-
119
-
# Use your custom session
120
-
agent = Agent(name="Assistant")
121
-
result =await Runner.run(
122
-
agent,
123
-
"Hello",
124
-
session=MyCustomSession("my_session")
125
-
)
126
-
```
127
-
128
20
## Get started
129
21
130
22
1. Set up your Python environment
131
23
132
-
- Option A: Using venv (traditional method)
24
+
- Option A: Using venv (traditional method)
25
+
133
26
```bash
134
27
python -m venv env
135
28
source env/bin/activate # On Windows: env\Scripts\activate
136
29
```
137
30
138
-
- Option B: Using uv (recommended)
31
+
- Option B: Using uv (recommended)
32
+
139
33
```bash
140
34
uv venv
141
35
source .venv/bin/activate # On Windows: .venv\Scripts\activate
@@ -263,6 +157,114 @@ The Agents SDK is designed to be highly flexible, allowing you to model a wide r
263
157
264
158
The Agents SDK automatically traces your agent runs, making it easy to track and debug the behavior of your agents. Tracing is extensible by design, supporting custom spans and a wide variety of external destinations, including [Logfire](https://logfire.pydantic.dev/docs/integrations/llms/openai/#openai-agents), [AgentOps](https://docs.agentops.ai/v1/integrations/agentssdk), [Braintrust](https://braintrust.dev/docs/guides/traces/integrations#openai-agents-sdk), [Scorecard](https://docs.scorecard.io/docs/documentation/features/tracing#openai-agents-sdk-integration), and [Keywords AI](https://docs.keywordsai.co/integration/development-frameworks/openai-agent). For more details about how to customize or disable tracing, see [Tracing](http://openai.github.io/openai-agents-python/tracing), which also includes a larger list of [external tracing processors](http://openai.github.io/openai-agents-python/tracing/#external-tracing-processors-list).
265
159
160
+
## Sessions
161
+
162
+
The Agents SDK provides built-in session memory to automatically maintain conversation history across multiple agent runs, eliminating the need to manually handle `.to_input_list()` between turns.
163
+
164
+
### Quick start
165
+
166
+
```python
167
+
from agents import Agent, Runner, SQLiteSession
168
+
169
+
# Create agent
170
+
agent = Agent(
171
+
name="Assistant",
172
+
instructions="Reply very concisely.",
173
+
)
174
+
175
+
# Create a session instance
176
+
session = SQLiteSession("conversation_123")
177
+
178
+
# First turn
179
+
result =await Runner.run(
180
+
agent,
181
+
"What city is the Golden Gate Bridge in?",
182
+
session=session
183
+
)
184
+
print(result.final_output) # "San Francisco"
185
+
186
+
# Second turn - agent automatically remembers previous context
0 commit comments