Skip to content

Commit 2d2e8f0

Browse files
committed
Merge branch 'main' of github.com:openai/openai-agents-python into alex/inline-snapshot
2 parents 4d2fa9d + d0a7b00 commit 2d2e8f0

33 files changed

+494
-119
lines changed

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ mypy:
1818
tests:
1919
uv run pytest
2020

21+
.PHONY: snapshots-fix
22+
snapshots-fix:
23+
uv run pytest --inline-snapshot=fix
24+
25+
.PHONY: snapshots-create
26+
snapshots-create:
27+
uv run pytest --inline-snapshot=create
28+
2129
.PHONY: old_version_tests
2230
old_version_tests:
2331
UV_PROJECT_ENVIRONMENT=.venv_39 uv run --python 3.9 -m pytest

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ The Agents SDK is designed to be highly flexible, allowing you to model a wide r
142142

143143
## Tracing
144144

145-
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).
145+
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).
146146

147147
## Development (only needed if you need to edit the SDK/examples)
148148

docs/tracing.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ The Agents SDK includes built-in tracing, collecting a comprehensive record of e
99
1. You can globally disable tracing by setting the env var `OPENAI_AGENTS_DISABLE_TRACING=1`
1010
2. You can disable tracing for a single run by setting [`agents.run.RunConfig.tracing_disabled`][] to `True`
1111

12+
***For organizations operating under a Zero Data Retention (ZDR) policy using OpenAI's APIs, tracing is unavailable.***
13+
1214
## Traces and spans
1315

1416
- **Traces** represent a single end-to-end operation of a "workflow". They're composed of Spans. Traces have the following properties:
@@ -88,10 +90,12 @@ To customize this default setup, to send traces to alternative or additional bac
8890
1. [`add_trace_processor()`][agents.tracing.add_trace_processor] lets you add an **additional** trace processor that will receive traces and spans as they are ready. This lets you do your own processing in addition to sending traces to OpenAI's backend.
8991
2. [`set_trace_processors()`][agents.tracing.set_trace_processors] lets you **replace** the default processors with your own trace processors. This means traces will not be sent to the OpenAI backend unless you include a `TracingProcessor` that does so.
9092

91-
External trace processors include:
93+
## External tracing processors list
9294

95+
- [Arize-Phoenix](https://docs.arize.com/phoenix/tracing/integrations-tracing/openai-agents-sdk)
9396
- [Braintrust](https://braintrust.dev/docs/guides/traces/integrations#openai-agents-sdk)
9497
- [Pydantic Logfire](https://logfire.pydantic.dev/docs/integrations/llms/openai/#openai-agents)
9598
- [AgentOps](https://docs.agentops.ai/v1/integrations/agentssdk)
96-
- [Scorecard](https://docs.scorecard.io/docs/documentation/features/tracing#openai-agents-sdk-integration))
99+
- [Scorecard](https://docs.scorecard.io/docs/documentation/features/tracing#openai-agents-sdk-integration)
97100
- [Keywords AI](https://docs.keywordsai.co/integration/development-frameworks/openai-agent)
101+
- [LangSmith](https://docs.smith.langchain.com/observability/how_to_guides/trace_with_openai_agents_sdk)

examples/agent_patterns/input_guardrails.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030

3131
### 1. An agent-based guardrail that is triggered if the user is asking to do math homework
3232
class MathHomeworkOutput(BaseModel):
33-
is_math_homework: bool
3433
reasoning: str
34+
is_math_homework: bool
3535

3636

3737
guardrail_agent = Agent(

examples/agent_patterns/llm_as_a_judge.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323

2424
@dataclass
2525
class EvaluationFeedback:
26-
score: Literal["pass", "needs_improvement", "fail"]
2726
feedback: str
27+
score: Literal["pass", "needs_improvement", "fail"]
2828

2929

3030
evaluator = Agent[None](

examples/basic/agent_lifecycle_example.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ class FinalResult(BaseModel):
7474

7575
start_agent = Agent(
7676
name="Start Agent",
77-
instructions="Generate a random number. If it's even, stop. If it's odd, hand off to the multipler agent.",
77+
instructions="Generate a random number. If it's even, stop. If it's odd, hand off to the multiply agent.",
7878
tools=[random_number],
7979
output_type=FinalResult,
8080
handoffs=[multiply_agent],

examples/basic/hello_world_jupyter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
agent = Agent(name="Assistant", instructions="You are a helpful assistant")
44

55
# Intended for Jupyter notebooks where there's an existing event loop
6-
result = await Runner.run(agent, "Write a haiku about recursion in programming.") # type: ignore[top-level-await] # noqa: F704
6+
result = await Runner.run(agent, "Write a haiku about recursion in programming.") # type: ignore[top-level-await] # noqa: F704
77
print(result.final_output)
88

99
# Code within code loops,

examples/handoffs/message_filter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ async def main():
6060

6161
print("Step 1 done")
6262

63-
# 2. Ask it to square a number
63+
# 2. Ask it to generate a number
6464
result = await Runner.run(
65-
second_agent,
65+
first_agent,
6666
input=result.to_input_list()
6767
+ [{"content": "Can you generate a random number between 0 and 100?", "role": "user"}],
6868
)

examples/handoffs/message_filter_streaming.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ async def main():
6060

6161
print("Step 1 done")
6262

63-
# 2. Ask it to square a number
63+
# 2. Ask it to generate a number
6464
result = await Runner.run(
65-
second_agent,
65+
first_agent,
6666
input=result.to_input_list()
6767
+ [{"content": "Can you generate a random number between 0 and 100?", "role": "user"}],
6868
)

pyproject.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ dev = [
4747
"mkdocstrings[python]>=0.28.0",
4848
"coverage>=7.6.12",
4949
"playwright==1.50.0",
50-
"inline-snapshot>=0.20.5",
50+
"inline-snapshot>=0.20.7",
5151
]
5252
[tool.uv.workspace]
5353
members = ["agents"]
@@ -118,3 +118,6 @@ filterwarnings = [
118118
markers = [
119119
"allow_call_model_methods: mark test as allowing calls to real model implementations",
120120
]
121+
122+
[tool.inline-snapshot]
123+
format-command="ruff format --stdin-filename {filename}"

0 commit comments

Comments
 (0)