Skip to content

Commit e7c2c19

Browse files
authored
Merge branch 'main' into patch-1
2 parents 333858b + 48ff99b commit e7c2c19

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1430
-144
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
name: Custom model providers
3+
about: Questions or bugs about using non-OpenAI models
4+
title: ''
5+
labels: bug
6+
assignees: ''
7+
8+
---
9+
10+
### Please read this first
11+
12+
- **Have you read the custom model provider docs, including the 'Common issues' section?** [Model provider docs](https://openai.github.io/openai-agents-python/models/#using-other-llm-providers)
13+
- **Have you searched for related issues?** Others may have faced similar issues.
14+
15+
### Describe the question
16+
A clear and concise description of what the question or bug is.
17+
18+
### Debug information
19+
- Agents SDK version: (e.g. `v0.0.3`)
20+
- Python version (e.g. Python 3.10)
21+
22+
### Repro steps
23+
Ideally provide a minimal python script that can be run to reproduce the issue.
24+
25+
### Expected behavior
26+
A clear and concise description of what you expected to happen.

.github/workflows/tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ jobs:
5050
enable-cache: true
5151
- name: Install dependencies
5252
run: make sync
53-
- name: Run tests
54-
run: make tests
53+
- name: Run tests with coverage
54+
run: make coverage
5555

5656
build-docs:
5757
runs-on: ubuntu-latest

Makefile

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

21+
.PHONY: coverage
22+
coverage:
23+
24+
uv run coverage run -m pytest
25+
uv run coverage xml -o coverage.xml
26+
uv run coverage report -m --fail-under=95
27+
28+
.PHONY: snapshots-fix
29+
snapshots-fix:
30+
uv run pytest --inline-snapshot=fix
31+
32+
.PHONY: snapshots-create
33+
snapshots-create:
34+
uv run pytest --inline-snapshot=create
35+
2136
.PHONY: old_version_tests
2237
old_version_tests:
2338
UV_PROJECT_ENVIRONMENT=.venv_39 uv run --python 3.9 -m pytest
@@ -34,4 +49,6 @@ serve-docs:
3449
.PHONY: deploy-docs
3550
deploy-docs:
3651
uv run mkdocs gh-deploy --force --verbose
52+
53+
3754

README.md

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ The OpenAI Agents SDK is a lightweight yet powerful framework for building multi
77
### Core concepts:
88

99
1. [**Agents**](https://openai.github.io/openai-agents-python/agents): LLMs configured with instructions, tools, guardrails, and handoffs
10-
2. [**Handoffs**](https://openai.github.io/openai-agents-python/handoffs/): Allow agents to transfer control to other agents for specific tasks
10+
2. [**Handoffs**](https://openai.github.io/openai-agents-python/handoffs/): A specialized tool call used by the Agents SDK for transferring control between agents
1111
3. [**Guardrails**](https://openai.github.io/openai-agents-python/guardrails/): Configurable safety checks for input and output validation
1212
4. [**Tracing**](https://openai.github.io/openai-agents-python/tracing/): Built-in tracking of agent runs, allowing you to view, debug and optimize your workflows
1313

@@ -142,15 +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:
146-
- [AgentOps](https://docs.agentops.ai/v1/integrations/agentssdk)
147-
- [Braintrust](https://braintrust.dev/docs/guides/traces/integrations#openai-agents-sdk)
148-
- [Comet Opik](https://www.comet.com/docs/opik/tracing/integrations/openai_agents)
149-
- [Keywords AI](https://docs.keywordsai.co/integration/development-frameworks/openai-agent)
150-
- [Logfire](https://logfire.pydantic.dev/docs/integrations/llms/openai/#openai-agents)
151-
- [Scorecard](https://docs.scorecard.io/docs/documentation/features/tracing#openai-agents-sdk-integration)
152-
153-
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).
154146

155147
## Development (only needed if you need to edit the SDK/examples)
156148

docs/guardrails.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ class MessageOutput(BaseModel): # (1)!
111111
response: str
112112

113113
class MathOutput(BaseModel): # (2)!
114-
is_math: bool
115114
reasoning: str
115+
is_math: bool
116116

117117
guardrail_agent = Agent(
118118
name="Guardrail check",

docs/tracing.md

Lines changed: 11 additions & 5 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,11 +90,15 @@ 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

93-
- [AgentOps](https://docs.agentops.ai/v1/integrations/agentssdk)
95+
- [Arize-Phoenix](https://docs.arize.com/phoenix/tracing/integrations-tracing/openai-agents-sdk)
96+
- [MLflow](https://mlflow.org/docs/latest/tracing/integrations/openai-agent)
9497
- [Braintrust](https://braintrust.dev/docs/guides/traces/integrations#openai-agents-sdk)
95-
- [Comet Opik](https://www.comet.com/docs/opik/tracing/integrations/openai_agents)
96-
- [Scorecard](https://docs.scorecard.io/docs/documentation/features/tracing#openai-agents-sdk-integration))
97-
- [Keywords AI](https://docs.keywordsai.co/integration/development-frameworks/openai-agent)
9898
- [Pydantic Logfire](https://logfire.pydantic.dev/docs/integrations/llms/openai/#openai-agents)
99+
- [AgentOps](https://docs.agentops.ai/v1/integrations/agentssdk)
100+
- [Scorecard](https://docs.scorecard.io/docs/documentation/features/tracing#openai-agents-sdk-integration)
101+
- [Keywords AI](https://docs.keywordsai.co/integration/development-frameworks/openai-agent)
102+
- [LangSmith](https://docs.smith.langchain.com/observability/how_to_guides/trace_with_openai_agents_sdk)
103+
- [Maxim AI](https://www.getmaxim.ai/docs/observe/integrations/openai-agents-sdk)
104+
- [Comet Opik](https://www.comet.com/docs/opik/tracing/integrations/openai_agents)

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,

0 commit comments

Comments
 (0)