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
Copy file name to clipboardExpand all lines: docs/models/index.md
+30Lines changed: 30 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -204,6 +204,36 @@ english_agent = Agent(
204
204
)
205
205
```
206
206
207
+
#### Common advanced `ModelSettings` options
208
+
209
+
When you are using the OpenAI Responses API, several request fields already have direct `ModelSettings` fields, so you do not need `extra_args` for them.
210
+
211
+
| Field | Use it for |
212
+
| --- | --- |
213
+
|`parallel_tool_calls`| Allow or forbid multiple tool calls in the same turn. |
214
+
|`truncation`| Set `"auto"` to let the Responses API drop the oldest conversation items instead of failing when context would overflow. |
215
+
|`prompt_cache_retention`| Keep cached prompt prefixes around longer, for example with `"24h"`. |
216
+
|`response_include`| Request richer response payloads such as `web_search_call.action.sources`, `file_search_call.results`, or `reasoning.encrypted_content`. |
217
+
|`top_logprobs`| Request top-token logprobs for output text. The SDK also adds `message.output_text.logprobs` automatically. |
Use `extra_args` when you need provider-specific or newer request fields that the SDK does not expose directly at the top level yet.
236
+
207
237
Also, when you use OpenAI's Responses API, [there are a few other optional parameters](https://platform.openai.com/docs/api-reference/responses/create) (e.g., `user`, `service_tier`, and so on). If they are not available at the top level, you can use `extra_args` to pass them as well.
See [SQLAlchemy Sessions](sqlalchemy_session.md) for detailed documentation.
379
380
381
+
### Dapr sessions
382
+
383
+
Use `DaprSession` when you already run Dapr sidecars or want session storage that can move across different state-store backends without changing your agent code.
384
+
385
+
```bash
386
+
pip install openai-agents[dapr]
387
+
```
388
+
389
+
```python
390
+
from agents import Agent, Runner
391
+
from agents.extensions.memory import DaprSession
392
+
393
+
agent = Agent(name="Assistant")
394
+
395
+
asyncwith DaprSession.from_address(
396
+
"user_123",
397
+
state_store_name="statestore",
398
+
dapr_address="localhost:50001",
399
+
) as session:
400
+
result =await Runner.run(agent, "Hello", session=session)
401
+
print(result.final_output)
402
+
```
403
+
404
+
Notes:
405
+
406
+
-`from_address(...)` creates and owns the Dapr client for you. If your app already manages one, construct `DaprSession(...)` directly with `dapr_client=...`.
407
+
- Pass `ttl=...` to let the backing state store expire old session data automatically when the store supports TTL.
408
+
- Pass `consistency=DAPR_CONSISTENCY_STRONG` when you need stronger read-after-write guarantees.
409
+
- The Dapr Python SDK also checks the HTTP sidecar endpoint. In local development, start Dapr with `--dapr-http-port 3500` as well as the gRPC port used in `dapr_address`.
410
+
- See [`examples/memory/dapr_session_example.py`](https://github.com/openai/openai-agents-python/tree/main/examples/memory/dapr_session_example.py) for a full setup walkthrough, including local components and troubleshooting.
0 commit comments