Commit graph

406 commits

Author SHA1 Message Date
xianghuijin
fb77c74fa1 Fix potential infinite tool call loop by resetting tool_choice after tool execution 2025-03-20 21:22:27 +08:00
Alex Hall
ea3e8ce230 lint 2025-03-20 13:56:11 +02:00
Alex Hall
7031d4ab87 Remove redundant weaker tracing assertions 2025-03-20 13:49:38 +02:00
Raduan77
96d1e8af8e fix typos in tests 2025-03-20 11:24:15 +01:00
Raduan77
e9f6d08260 fix typos in src/ 2025-03-20 11:24:08 +01:00
Raduan77
65264b6b8a fix typos in /examples 2025-03-20 11:23:57 +01:00
Shyamal H Anadkat
0dec5712db Adds example for financial agent 2025-03-19 22:33:13 -07:00
Rohan Mehta
cef3d5357c
formatting updates to examples doc (#249) 2025-03-19 17:26:24 -04:00
James Hills
d295a53e53
formatting updates to examples doc 2025-03-19 14:23:28 -07:00
Rohan Mehta
249bb56c23
add examples section to docs (#242)
Have gotten feedback that Examples are somewhat buried in the Github
docs. Adding new page after quickstart.
2025-03-19 15:42:41 -04:00
jhills20
4dd3e210ac add examples section to docs 2025-03-19 11:43:09 -07:00
Rohan Mehta
82754c7a85
v0.0.5 (#241) 2025-03-19 12:35:15 -04:00
Rohan Mehta
1ed181c641 v0.0.5 2025-03-19 12:32:36 -04:00
Rohan Mehta
54cf54c6f5
Fix breaking changes from openai 1.66.2 (#232)
Breaking change in 1.66.2
2025-03-19 12:31:59 -04:00
Rohan Mehta
545c20342a
chore(docs): Added comet opik to tracing AND formatted into a list (#73)
Comet Opik added support for Agent SDK tracing and should be included.
2025-03-19 12:31:02 -04:00
Rohan Mehta
8c9974bc90 Fix breaking changes from openai 1.66.2 2025-03-19 12:30:45 -04:00
Rohan Mehta
6d35c33592
Introduce tool_use_behavior on agents (#203)
## Context
By default, the outputs of tools are sent to the LLM again. The LLM gets
to read the outputs, and produce a new response. There are cases where
this is not desired:
1. Every tool results in another round trip, and sometimes the output of
the tool is enough.
2. If you force tool use (via model settings `tool_choice=required`),
then the agent will just infinite loop.

This enables you to have different behavior, e.g. use the first tool
output as the final output, or write a custom function to process tool
results and potentially produce an output.

## Test plan
Added new tests and ran existing tests
Also added examples.


Closes #117
2025-03-19 12:27:02 -04:00
Vincent Koc
e7c2c19564
Merge branch 'main' into patch-1 2025-03-20 02:57:34 +11:00
Rohan Mehta
48ff99bb73
fix reasoning order in guardrails.md (#234) 2025-03-18 23:27:33 -04:00
CCM
bc8369c76a
fix reasoning order in guardrails.md 2025-03-19 11:10:58 +08:00
Rohan Mehta
10aa5555af Introduce tool_use_behavior on agents 2025-03-18 21:55:12 -04:00
Rohan Mehta
6f7e801da0
Update tests and docs for strict mode decorator (#205)
As titled. Test plan: unit tests/docs.
2025-03-18 21:35:00 -04:00
Rohan Mehta
ff65fb48dd
Add min 95% code coverage (#229)
Run the tests with `coverage`, and make sure the min coverage is 95%.
2025-03-18 16:50:00 -04:00
Rohan Mehta
74b197bc2c Add min 95% code coverage 2025-03-18 16:48:43 -04:00
Dmitry Pimenov
3b2afe118d
chore: adds Maxim AI to tracing processors (#210) 2025-03-18 09:10:52 -07:00
Rohan Mehta
97508557b9
[doc] add mlflow tracing integration (#171)
Hi team! Congrats on the new Agents SDK launch!

This PR adds MLflow to the tracing documentation, as it supports
automatic tracing for OpenAI Agents SDK. It has also been supporting
tracing for
[Swarm](https://mlflow.org/docs/latest/tracing/integrations/swarm) as
well, so it is fantastic that the new SDK offers built-in mechanism for
3P trace providers🙂


![image](https://github.com/user-attachments/assets/d36382da-dca1-4335-a915-ca94a994e26a)
2025-03-18 10:21:54 -04:00
Martín Bravo
f4edc1f372 style: improve string formatting in visualization functions 2025-03-18 10:15:41 +01:00
Martín Bravo
b7627cb642 style: improve string formatting 2025-03-18 10:14:52 +01:00
Martín Bravo
0079bca717 style: improve code formatting and readability in visualization functions 2025-03-18 10:09:44 +01:00
Martín Bravo
39ff00dd9d rename: test_visualization.py 2025-03-18 09:59:47 +01:00
Martín Bravo
53367be893 feat: add visualization module for agent graphs using Graphviz 2025-03-18 09:55:30 +01:00
Martín Bravo
c745fe156a feat: add documentation for agent visualization using Graphviz 2025-03-18 09:55:23 +01:00
Martín Bravo
6f2f7293a0 refactor: move graphviz dependency to visualization section 2025-03-18 09:53:53 +01:00
Martín Bravo
f7c594da08 feat: add visualization functions for agent graphs 2025-03-18 09:53:48 +01:00
B-Step62
e0eb4be145 [doc] add mlflow tracing integration
Signed-off-by: B-Step62 <yuki.watanabe@databricks.com>
2025-03-18 11:29:21 +09:00
Akshay Deo
e5befd0cba
chore: adds Maxim AI to tracing processors 2025-03-18 07:49:33 +05:30
Martín Bravo
aff1d60ea1 Merge branch 'main' of https://github.com/openai/openai-agents-python into feat/draw_graph 2025-03-17 23:50:52 +01:00
Dmitry Pimenov
fe6bb8c8ab
Docs: update readme text to clarify handoffs (#208)
Clarifying that the handoff abstraction is implemented via Responses
tool calling
2025-03-17 15:15:13 -07:00
Dmitry Pimenov
a43cf1542b clarifying that handoffs are a type of tool call under the hood 2025-03-17 15:05:15 -07:00
Rohan Mehta
3a97b15b89
Stronger tracing tests with inline-snapshot (#25)
`assert len(spans) == 12` is a very weak assertion. This PR asserts the
exported traces and spans more precisely in a readable tree format. And
when the format of an exported trace/span changes (e.g. a new key is
added to every span), you can use `pytest --inline-snapshot=fix` to
update all relevant tests automatically. See
https://15r10nk.github.io/inline-snapshot/latest/ for more info.
2025-03-17 17:59:04 -04:00
Alex Hall
7eb2bcee15 mypy 2025-03-17 23:56:42 +02:00
Alex Hall
2d2e8f0e34 Merge branch 'main' of github.com:openai/openai-agents-python into alex/inline-snapshot 2025-03-17 23:55:56 +02:00
Rohan Mehta
d0a7b00086
Fix typo on Agent documentation (#151)
Argument name is not description but handoff_description
2025-03-17 16:51:47 -04:00
Carlos Souza
64150c8aea Fix lint 2025-03-17 16:14:28 -04:00
Rohan Mehta
2bff04719b
Fix handoffs example use cases (#156)
## Changes
- In this handoff example, we need to use `first_agent` with
`random_number_tool`, instead of `second_agent` without that tool, since
the user is asking to generate a random number.
- fixed typo in comments
2025-03-17 15:59:18 -04:00
Rohan Mehta
fad23f1a3d
fix typo in agent_lifecycle_example.py (#161) 2025-03-17 15:59:00 -04:00
Rohan Mehta
82136d7439
docs: add arize-phoenix to tracing documentation (#169) 2025-03-17 15:58:28 -04:00
Rohan Mehta
a612e6a090
docs: List LangSmith tracing integration (#197)
LangChain employee/maintainer, happy to make edits to our
docs/integrations if needed.
2025-03-17 15:58:20 -04:00
Rohan Mehta
83ec26d200
fix reasoning order in examples (#186)
I think we need to put reasoning-related outputs first to encourage CoT
reasoning.
2025-03-17 15:57:52 -04:00
Rohan Mehta
0989cd9184
Add TracingProcessor export to __init__.py (#192)
# Summary
This adds the missing TracingProcessor export to  __init__.py.

# Behavior
When trying to add a custom tracing processor, the TracingProcessor
importing fails with not found error when trying the example usage
proposed in issue #164

Specifically this line throws the error:
`add_trace_processor(MyTracingProcessor("output"))`

# Expected Behavior
Inspecting the init file, simply the import/export was missing. Adding
these made the example code work for me

# Test plan
Local dev of example code in #164

# Issue number
#164

# Checks
None
2025-03-17 15:39:04 -04:00