@@ -117,27 +117,6 @@ print(f"Agent: {result.final_output}")
117
117
118
118
The SDK provides several session implementations for different use cases:
119
119
120
- ### SQLite sessions
121
-
122
- The default, lightweight session implementation using SQLite:
123
-
124
- ``` python
125
- from agents import SQLiteSession
126
-
127
- # In-memory database (lost when process ends)
128
- session = SQLiteSession(" user_123" )
129
-
130
- # Persistent file-based database
131
- session = SQLiteSession(" user_123" , " conversations.db" )
132
-
133
- # Use the session
134
- result = await Runner.run(
135
- agent,
136
- " Hello" ,
137
- session = session
138
- )
139
- ```
140
-
141
120
### OpenAI Conversations API sessions
142
121
143
122
Use [ OpenAI's Conversations API] ( https://platform.openai.com/docs/api-reference/conversations ) through ` OpenAIConversationsSession ` .
@@ -174,6 +153,27 @@ result = await Runner.run(
174
153
print (result.final_output) # "California"
175
154
```
176
155
156
+ ### SQLite sessions
157
+
158
+ The default, lightweight session implementation using SQLite:
159
+
160
+ ``` python
161
+ from agents import SQLiteSession
162
+
163
+ # In-memory database (lost when process ends)
164
+ session = SQLiteSession(" user_123" )
165
+
166
+ # Persistent file-based database
167
+ session = SQLiteSession(" user_123" , " conversations.db" )
168
+
169
+ # Use the session
170
+ result = await Runner.run(
171
+ agent,
172
+ " Hello" ,
173
+ session = session
174
+ )
175
+ ```
176
+
177
177
### SQLAlchemy sessions
178
178
179
179
Production-ready sessions using any SQLAlchemy-supported database:
@@ -423,8 +423,8 @@ result = await Runner.run(
423
423
For detailed API documentation, see:
424
424
425
425
- [ ` Session ` ] [ agents.memory.session.Session ] - Protocol interface
426
- - [ ` SQLiteSession ` ] [ agents.memory.sqlite_session.SQLiteSession ] - Basic SQLite implementation
427
426
- [ ` OpenAIConversationsSession ` ] [ agents.memory.OpenAIConversationsSession ] - OpenAI Conversations API implementation
427
+ - [ ` SQLiteSession ` ] [ agents.memory.sqlite_session.SQLiteSession ] - Basic SQLite implementation
428
428
- [ ` SQLAlchemySession ` ] [ agents.extensions.memory.sqlalchemy_session.SQLAlchemySession ] - SQLAlchemy-powered implementation
429
429
- [ ` AdvancedSQLiteSession ` ] [ agents.extensions.memory.advanced_sqlite_session.AdvancedSQLiteSession ] - Enhanced SQLite with branching and analytics
430
430
- [ ` EncryptedSession ` ] [ agents.extensions.memory.encrypt_session.EncryptedSession ] - Encrypted wrapper for any session
0 commit comments