openai-agents 0.0.2__tar.gz → 0.0.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of openai-agents might be problematic. Click here for more details.
- openai_agents-0.0.4/.github/ISSUE_TEMPLATE/bug_report.md +28 -0
- openai_agents-0.0.4/.github/ISSUE_TEMPLATE/feature_request.md +16 -0
- openai_agents-0.0.4/.github/ISSUE_TEMPLATE/question.md +16 -0
- openai_agents-0.0.4/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md +18 -0
- openai_agents-0.0.4/.github/workflows/issues.yml +23 -0
- openai_agents-0.0.4/.gitignore +144 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/PKG-INFO +16 -12
- {openai_agents-0.0.2 → openai_agents-0.0.4}/README.md +14 -10
- {openai_agents-0.0.2/tests → openai_agents-0.0.4}/docs/agents.md +2 -1
- {openai_agents-0.0.2/tests → openai_agents-0.0.4}/docs/config.md +2 -2
- {openai_agents-0.0.2/tests → openai_agents-0.0.4}/docs/context.md +2 -1
- {openai_agents-0.0.2/tests → openai_agents-0.0.4}/docs/guardrails.md +2 -2
- {openai_agents-0.0.2/tests → openai_agents-0.0.4}/docs/index.md +2 -2
- openai_agents-0.0.4/docs/models.md +66 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/docs/multi_agent.md +2 -2
- {openai_agents-0.0.2 → openai_agents-0.0.4}/docs/quickstart.md +3 -0
- {openai_agents-0.0.2/tests → openai_agents-0.0.4}/docs/results.md +1 -1
- {openai_agents-0.0.2/tests → openai_agents-0.0.4}/docs/running_agents.md +1 -1
- {openai_agents-0.0.2/tests → openai_agents-0.0.4}/docs/tracing.md +4 -2
- {openai_agents-0.0.2/tests → openai_agents-0.0.4}/examples/agent_patterns/README.md +1 -1
- {openai_agents-0.0.2 → openai_agents-0.0.4}/examples/agent_patterns/input_guardrails.py +1 -1
- openai_agents-0.0.4/examples/basic/hello_world_jupyter.py +11 -0
- openai_agents-0.0.4/examples/model_providers/README.md +19 -0
- openai_agents-0.0.4/examples/model_providers/custom_example_agent.py +51 -0
- openai_agents-0.0.4/examples/model_providers/custom_example_global.py +55 -0
- openai_agents-0.0.4/examples/model_providers/custom_example_provider.py +73 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/examples/research_bot/README.md +1 -1
- {openai_agents-0.0.2/tests → openai_agents-0.0.4}/examples/tools/computer_use.py +5 -4
- {openai_agents-0.0.2/tests → openai_agents-0.0.4}/pyproject.toml +2 -2
- {openai_agents-0.0.2/tests → openai_agents-0.0.4}/src/agents/__init__.py +10 -4
- {openai_agents-0.0.2 → openai_agents-0.0.4}/src/agents/_config.py +6 -3
- {openai_agents-0.0.2/tests → openai_agents-0.0.4}/src/agents/_run_impl.py +3 -3
- {openai_agents-0.0.2/tests → openai_agents-0.0.4}/src/agents/agent_output.py +1 -1
- {openai_agents-0.0.2 → openai_agents-0.0.4}/src/agents/guardrail.py +1 -1
- {openai_agents-0.0.2/tests → openai_agents-0.0.4}/src/agents/items.py +3 -3
- {openai_agents-0.0.2 → openai_agents-0.0.4}/src/agents/model_settings.py +21 -0
- {openai_agents-0.0.2/tests → openai_agents-0.0.4}/src/agents/models/openai_chatcompletions.py +27 -1
- {openai_agents-0.0.2/tests → openai_agents-0.0.4}/src/agents/models/openai_provider.py +24 -11
- {openai_agents-0.0.2 → openai_agents-0.0.4}/src/agents/models/openai_responses.py +5 -3
- {openai_agents-0.0.2/tests → openai_agents-0.0.4}/src/agents/result.py +0 -2
- {openai_agents-0.0.2 → openai_agents-0.0.4}/src/agents/tracing/processors.py +1 -4
- {openai_agents-0.0.2 → openai_agents-0.0.4}/tests/test_config.py +6 -3
- {openai_agents-0.0.2 → openai_agents-0.0.4}/tests/test_items_helpers.py +9 -7
- {openai_agents-0.0.2 → openai_agents-0.0.4}/tests/test_openai_chatcompletions_converter.py +35 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/tests/test_openai_chatcompletions_stream.py +5 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/tests/test_openai_responses_converter.py +2 -2
- {openai_agents-0.0.2 → openai_agents-0.0.4}/tests/test_run_step_processing.py +3 -3
- {openai_agents-0.0.2 → openai_agents-0.0.4}/uv.lock +5 -5
- openai_agents-0.0.2/docs/agents.md +0 -131
- openai_agents-0.0.2/docs/config.md +0 -94
- openai_agents-0.0.2/docs/context.md +0 -76
- openai_agents-0.0.2/docs/guardrails.md +0 -154
- openai_agents-0.0.2/docs/index.md +0 -52
- openai_agents-0.0.2/docs/models.md +0 -73
- openai_agents-0.0.2/docs/results.md +0 -52
- openai_agents-0.0.2/docs/running_agents.md +0 -95
- openai_agents-0.0.2/docs/tracing.md +0 -95
- openai_agents-0.0.2/examples/agent_patterns/README.md +0 -54
- openai_agents-0.0.2/examples/tools/computer_use.py +0 -165
- openai_agents-0.0.2/pyproject.toml +0 -119
- openai_agents-0.0.2/src/agents/__init__.py +0 -223
- openai_agents-0.0.2/src/agents/_run_impl.py +0 -792
- openai_agents-0.0.2/src/agents/agent_output.py +0 -144
- openai_agents-0.0.2/src/agents/items.py +0 -246
- openai_agents-0.0.2/src/agents/models/openai_chatcompletions.py +0 -952
- openai_agents-0.0.2/src/agents/models/openai_provider.py +0 -65
- openai_agents-0.0.2/src/agents/result.py +0 -220
- openai_agents-0.0.2/src/openai_agents.egg-info/PKG-INFO +0 -217
- openai_agents-0.0.2/src/openai_agents.egg-info/SOURCES.txt +0 -81
- openai_agents-0.0.2/src/openai_agents.egg-info/dependency_links.txt +0 -1
- openai_agents-0.0.2/src/openai_agents.egg-info/requires.txt +0 -6
- openai_agents-0.0.2/src/openai_agents.egg-info/top_level.txt +0 -1
- openai_agents-0.0.2/tests/LICENSE +0 -21
- openai_agents-0.0.2/tests/Makefile +0 -37
- openai_agents-0.0.2/tests/README.md +0 -174
- openai_agents-0.0.2/tests/docs/assets/images/favicon-platform.svg +0 -16
- openai_agents-0.0.2/tests/docs/assets/images/orchestration.png +0 -0
- openai_agents-0.0.2/tests/docs/assets/logo.svg +0 -15
- openai_agents-0.0.2/tests/docs/handoffs.md +0 -113
- openai_agents-0.0.2/tests/docs/models.md +0 -73
- openai_agents-0.0.2/tests/docs/multi_agent.md +0 -37
- openai_agents-0.0.2/tests/docs/quickstart.md +0 -186
- openai_agents-0.0.2/tests/docs/ref/agent.md +0 -3
- openai_agents-0.0.2/tests/docs/ref/agent_output.md +0 -3
- openai_agents-0.0.2/tests/docs/ref/exceptions.md +0 -3
- openai_agents-0.0.2/tests/docs/ref/extensions/handoff_filters.md +0 -3
- openai_agents-0.0.2/tests/docs/ref/extensions/handoff_prompt.md +0 -8
- openai_agents-0.0.2/tests/docs/ref/function_schema.md +0 -3
- openai_agents-0.0.2/tests/docs/ref/guardrail.md +0 -3
- openai_agents-0.0.2/tests/docs/ref/handoffs.md +0 -3
- openai_agents-0.0.2/tests/docs/ref/index.md +0 -13
- openai_agents-0.0.2/tests/docs/ref/items.md +0 -3
- openai_agents-0.0.2/tests/docs/ref/lifecycle.md +0 -6
- openai_agents-0.0.2/tests/docs/ref/model_settings.md +0 -3
- openai_agents-0.0.2/tests/docs/ref/models/interface.md +0 -3
- openai_agents-0.0.2/tests/docs/ref/models/openai_chatcompletions.md +0 -3
- openai_agents-0.0.2/tests/docs/ref/models/openai_responses.md +0 -3
- openai_agents-0.0.2/tests/docs/ref/result.md +0 -3
- openai_agents-0.0.2/tests/docs/ref/run.md +0 -8
- openai_agents-0.0.2/tests/docs/ref/run_context.md +0 -3
- openai_agents-0.0.2/tests/docs/ref/stream_events.md +0 -3
- openai_agents-0.0.2/tests/docs/ref/tool.md +0 -3
- openai_agents-0.0.2/tests/docs/ref/tracing/create.md +0 -3
- openai_agents-0.0.2/tests/docs/ref/tracing/index.md +0 -3
- openai_agents-0.0.2/tests/docs/ref/tracing/processor_interface.md +0 -3
- openai_agents-0.0.2/tests/docs/ref/tracing/processors.md +0 -3
- openai_agents-0.0.2/tests/docs/ref/tracing/scope.md +0 -3
- openai_agents-0.0.2/tests/docs/ref/tracing/setup.md +0 -3
- openai_agents-0.0.2/tests/docs/ref/tracing/span_data.md +0 -3
- openai_agents-0.0.2/tests/docs/ref/tracing/spans.md +0 -9
- openai_agents-0.0.2/tests/docs/ref/tracing/traces.md +0 -3
- openai_agents-0.0.2/tests/docs/ref/tracing/util.md +0 -3
- openai_agents-0.0.2/tests/docs/ref/usage.md +0 -3
- openai_agents-0.0.2/tests/docs/streaming.md +0 -87
- openai_agents-0.0.2/tests/docs/stylesheets/extra.css +0 -194
- openai_agents-0.0.2/tests/docs/tools.md +0 -270
- openai_agents-0.0.2/tests/examples/__init__.py +0 -3
- openai_agents-0.0.2/tests/examples/agent_patterns/agents_as_tools.py +0 -79
- openai_agents-0.0.2/tests/examples/agent_patterns/deterministic.py +0 -80
- openai_agents-0.0.2/tests/examples/agent_patterns/input_guardrails.py +0 -105
- openai_agents-0.0.2/tests/examples/agent_patterns/llm_as_a_judge.py +0 -76
- openai_agents-0.0.2/tests/examples/agent_patterns/output_guardrails.py +0 -80
- openai_agents-0.0.2/tests/examples/agent_patterns/parallelization.py +0 -61
- openai_agents-0.0.2/tests/examples/agent_patterns/routing.py +0 -70
- openai_agents-0.0.2/tests/examples/basic/agent_lifecycle_example.py +0 -112
- openai_agents-0.0.2/tests/examples/basic/dynamic_system_prompt.py +0 -69
- openai_agents-0.0.2/tests/examples/basic/hello_world.py +0 -20
- openai_agents-0.0.2/tests/examples/basic/lifecycle_example.py +0 -118
- openai_agents-0.0.2/tests/examples/basic/stream_items.py +0 -65
- openai_agents-0.0.2/tests/examples/basic/stream_text.py +0 -21
- openai_agents-0.0.2/tests/examples/customer_service/main.py +0 -169
- openai_agents-0.0.2/tests/examples/handoffs/message_filter.py +0 -176
- openai_agents-0.0.2/tests/examples/handoffs/message_filter_streaming.py +0 -176
- openai_agents-0.0.2/tests/examples/research_bot/README.md +0 -25
- openai_agents-0.0.2/tests/examples/research_bot/__init__.py +0 -1
- openai_agents-0.0.2/tests/examples/research_bot/agents/__init__.py +0 -0
- openai_agents-0.0.2/tests/examples/research_bot/agents/planner_agent.py +0 -29
- openai_agents-0.0.2/tests/examples/research_bot/agents/search_agent.py +0 -18
- openai_agents-0.0.2/tests/examples/research_bot/agents/writer_agent.py +0 -33
- openai_agents-0.0.2/tests/examples/research_bot/main.py +0 -12
- openai_agents-0.0.2/tests/examples/research_bot/manager.py +0 -119
- openai_agents-0.0.2/tests/examples/research_bot/printer.py +0 -41
- openai_agents-0.0.2/tests/examples/research_bot/sample_outputs/product_recs.md +0 -180
- openai_agents-0.0.2/tests/examples/research_bot/sample_outputs/product_recs.txt +0 -212
- openai_agents-0.0.2/tests/examples/research_bot/sample_outputs/vacation.md +0 -177
- openai_agents-0.0.2/tests/examples/research_bot/sample_outputs/vacation.txt +0 -206
- openai_agents-0.0.2/tests/examples/tools/file_search.py +0 -36
- openai_agents-0.0.2/tests/examples/tools/web_search.py +0 -23
- openai_agents-0.0.2/tests/mkdocs.yml +0 -121
- openai_agents-0.0.2/tests/src/agents/_config.py +0 -23
- openai_agents-0.0.2/tests/src/agents/_debug.py +0 -17
- openai_agents-0.0.2/tests/src/agents/_utils.py +0 -61
- openai_agents-0.0.2/tests/src/agents/agent.py +0 -159
- openai_agents-0.0.2/tests/src/agents/computer.py +0 -107
- openai_agents-0.0.2/tests/src/agents/exceptions.py +0 -63
- openai_agents-0.0.2/tests/src/agents/extensions/__init__.py +0 -0
- openai_agents-0.0.2/tests/src/agents/extensions/handoff_filters.py +0 -67
- openai_agents-0.0.2/tests/src/agents/extensions/handoff_prompt.py +0 -19
- openai_agents-0.0.2/tests/src/agents/function_schema.py +0 -340
- openai_agents-0.0.2/tests/src/agents/guardrail.py +0 -320
- openai_agents-0.0.2/tests/src/agents/handoffs.py +0 -236
- openai_agents-0.0.2/tests/src/agents/lifecycle.py +0 -105
- openai_agents-0.0.2/tests/src/agents/logger.py +0 -3
- openai_agents-0.0.2/tests/src/agents/model_settings.py +0 -35
- openai_agents-0.0.2/tests/src/agents/models/__init__.py +0 -0
- openai_agents-0.0.2/tests/src/agents/models/_openai_shared.py +0 -34
- openai_agents-0.0.2/tests/src/agents/models/fake_id.py +0 -5
- openai_agents-0.0.2/tests/src/agents/models/interface.py +0 -107
- openai_agents-0.0.2/tests/src/agents/models/openai_responses.py +0 -384
- openai_agents-0.0.2/tests/src/agents/run.py +0 -904
- openai_agents-0.0.2/tests/src/agents/run_context.py +0 -26
- openai_agents-0.0.2/tests/src/agents/stream_events.py +0 -58
- openai_agents-0.0.2/tests/src/agents/strict_schema.py +0 -167
- openai_agents-0.0.2/tests/src/agents/tool.py +0 -286
- openai_agents-0.0.2/tests/src/agents/tracing/__init__.py +0 -97
- openai_agents-0.0.2/tests/src/agents/tracing/create.py +0 -306
- openai_agents-0.0.2/tests/src/agents/tracing/logger.py +0 -3
- openai_agents-0.0.2/tests/src/agents/tracing/processor_interface.py +0 -69
- openai_agents-0.0.2/tests/src/agents/tracing/processors.py +0 -261
- openai_agents-0.0.2/tests/src/agents/tracing/scope.py +0 -45
- openai_agents-0.0.2/tests/src/agents/tracing/setup.py +0 -211
- openai_agents-0.0.2/tests/src/agents/tracing/span_data.py +0 -188
- openai_agents-0.0.2/tests/src/agents/tracing/spans.py +0 -264
- openai_agents-0.0.2/tests/src/agents/tracing/traces.py +0 -195
- openai_agents-0.0.2/tests/src/agents/tracing/util.py +0 -17
- openai_agents-0.0.2/tests/src/agents/usage.py +0 -22
- openai_agents-0.0.2/tests/src/agents/version.py +0 -7
- openai_agents-0.0.2/tests/src/openai_agents.egg-info/PKG-INFO +0 -217
- openai_agents-0.0.2/tests/src/openai_agents.egg-info/SOURCES.txt +0 -81
- openai_agents-0.0.2/tests/src/openai_agents.egg-info/dependency_links.txt +0 -1
- openai_agents-0.0.2/tests/src/openai_agents.egg-info/requires.txt +0 -6
- openai_agents-0.0.2/tests/src/openai_agents.egg-info/top_level.txt +0 -1
- {openai_agents-0.0.2 → openai_agents-0.0.4}/.github/workflows/docs.yml +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/.github/workflows/publish.yml +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/.github/workflows/tests.yml +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/.prettierrc +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/LICENSE +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/Makefile +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/docs/assets/images/favicon-platform.svg +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/docs/assets/images/orchestration.png +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/docs/assets/logo.svg +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/docs/handoffs.md +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/docs/ref/agent.md +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/docs/ref/agent_output.md +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/docs/ref/exceptions.md +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/docs/ref/extensions/handoff_filters.md +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/docs/ref/extensions/handoff_prompt.md +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/docs/ref/function_schema.md +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/docs/ref/guardrail.md +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/docs/ref/handoffs.md +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/docs/ref/index.md +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/docs/ref/items.md +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/docs/ref/lifecycle.md +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/docs/ref/model_settings.md +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/docs/ref/models/interface.md +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/docs/ref/models/openai_chatcompletions.md +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/docs/ref/models/openai_responses.md +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/docs/ref/result.md +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/docs/ref/run.md +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/docs/ref/run_context.md +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/docs/ref/stream_events.md +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/docs/ref/tool.md +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/docs/ref/tracing/create.md +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/docs/ref/tracing/index.md +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/docs/ref/tracing/processor_interface.md +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/docs/ref/tracing/processors.md +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/docs/ref/tracing/scope.md +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/docs/ref/tracing/setup.md +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/docs/ref/tracing/span_data.md +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/docs/ref/tracing/spans.md +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/docs/ref/tracing/traces.md +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/docs/ref/tracing/util.md +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/docs/ref/usage.md +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/docs/streaming.md +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/docs/stylesheets/extra.css +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/docs/tools.md +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/examples/__init__.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/examples/agent_patterns/agents_as_tools.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/examples/agent_patterns/deterministic.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/examples/agent_patterns/llm_as_a_judge.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/examples/agent_patterns/output_guardrails.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/examples/agent_patterns/parallelization.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/examples/agent_patterns/routing.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/examples/basic/agent_lifecycle_example.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/examples/basic/dynamic_system_prompt.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/examples/basic/hello_world.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/examples/basic/lifecycle_example.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/examples/basic/stream_items.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/examples/basic/stream_text.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/examples/customer_service/main.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/examples/handoffs/message_filter.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/examples/handoffs/message_filter_streaming.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/examples/research_bot/__init__.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/examples/research_bot/agents/__init__.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/examples/research_bot/agents/planner_agent.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/examples/research_bot/agents/search_agent.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/examples/research_bot/agents/writer_agent.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/examples/research_bot/main.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/examples/research_bot/manager.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/examples/research_bot/printer.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/examples/research_bot/sample_outputs/product_recs.md +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/examples/research_bot/sample_outputs/product_recs.txt +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/examples/research_bot/sample_outputs/vacation.md +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/examples/research_bot/sample_outputs/vacation.txt +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/examples/tools/file_search.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/examples/tools/web_search.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/mkdocs.yml +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/src/agents/_debug.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/src/agents/_utils.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/src/agents/agent.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/src/agents/computer.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/src/agents/exceptions.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/src/agents/extensions/__init__.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/src/agents/extensions/handoff_filters.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/src/agents/extensions/handoff_prompt.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/src/agents/function_schema.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/src/agents/handoffs.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/src/agents/lifecycle.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/src/agents/logger.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/src/agents/models/__init__.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/src/agents/models/_openai_shared.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/src/agents/models/fake_id.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/src/agents/models/interface.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/src/agents/run.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/src/agents/run_context.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/src/agents/stream_events.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/src/agents/strict_schema.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/src/agents/tool.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/src/agents/tracing/__init__.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/src/agents/tracing/create.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/src/agents/tracing/logger.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/src/agents/tracing/processor_interface.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/src/agents/tracing/scope.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/src/agents/tracing/setup.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/src/agents/tracing/span_data.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/src/agents/tracing/spans.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/src/agents/tracing/traces.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/src/agents/tracing/util.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/src/agents/usage.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/src/agents/version.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/tests/__init__.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/tests/conftest.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/tests/fake_model.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/tests/test_agent_config.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/tests/test_agent_hooks.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/tests/test_agent_runner.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/tests/test_agent_runner_streamed.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/tests/test_agent_tracing.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/tests/test_computer_action.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/tests/test_doc_parsing.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/tests/test_extension_filters.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/tests/test_function_schema.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/tests/test_function_tool.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/tests/test_function_tool_decorator.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/tests/test_global_hooks.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/tests/test_guardrails.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/tests/test_handoff_tool.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/tests/test_max_turns.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/tests/test_openai_chatcompletions.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/tests/test_output_tool.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/tests/test_responses.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/tests/test_responses_tracing.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/tests/test_result_cast.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/tests/test_run_config.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/tests/test_run_step_execution.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/tests/test_strict_schema.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/tests/test_tool_converter.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/tests/test_trace_processor.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/tests/test_tracing.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/tests/test_tracing_errors.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/tests/test_tracing_errors_streamed.py +0 -0
- {openai_agents-0.0.2 → openai_agents-0.0.4}/tests/testing_processor.py +0 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Bug report
|
|
3
|
+
about: Report a bug
|
|
4
|
+
title: ''
|
|
5
|
+
labels: bug
|
|
6
|
+
assignees: ''
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
### Please read this first
|
|
11
|
+
|
|
12
|
+
- **Have you read the docs?**[Agents SDK docs](https://openai.github.io/openai-agents-python/)
|
|
13
|
+
- **Have you searched for related issues?** Others may have faced similar issues.
|
|
14
|
+
|
|
15
|
+
### Describe the bug
|
|
16
|
+
A clear and concise description of what the 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
|
+
|
|
24
|
+
Ideally provide a minimal python script that can be run to reproduce the bug.
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### Expected behavior
|
|
28
|
+
A clear and concise description of what you expected to happen.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Feature request
|
|
3
|
+
about: Suggest an idea for this project
|
|
4
|
+
title: ''
|
|
5
|
+
labels: enhancement
|
|
6
|
+
assignees: ''
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
### Please read this first
|
|
11
|
+
|
|
12
|
+
- **Have you read the docs?**[Agents SDK docs](https://openai.github.io/openai-agents-python/)
|
|
13
|
+
- **Have you searched for related issues?** Others may have had similar requesrs
|
|
14
|
+
|
|
15
|
+
### Describe the feature
|
|
16
|
+
What is the feature you're requesting? How would it work? Please provide examples and details if possible.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Question
|
|
3
|
+
about: Questions about the SDK
|
|
4
|
+
title: ''
|
|
5
|
+
labels: question
|
|
6
|
+
assignees: ''
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
### Please read this first
|
|
11
|
+
|
|
12
|
+
- **Have you read the docs?**[Agents SDK docs](https://openai.github.io/openai-agents-python/)
|
|
13
|
+
- **Have you searched for related issues?** Others may have had similar requesrs
|
|
14
|
+
|
|
15
|
+
### Question
|
|
16
|
+
Describe your question. Provide details if available.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
### Summary
|
|
2
|
+
|
|
3
|
+
<!-- Please give a short summary of the change and the problem this solves. -->
|
|
4
|
+
|
|
5
|
+
### Test plan
|
|
6
|
+
|
|
7
|
+
<!-- Please explain how this was tested -->
|
|
8
|
+
|
|
9
|
+
### Issue number
|
|
10
|
+
|
|
11
|
+
<!-- For example: "Closes #1234" -->
|
|
12
|
+
|
|
13
|
+
### Checks
|
|
14
|
+
|
|
15
|
+
- [ ] I've added new tests (if relevant)
|
|
16
|
+
- [ ] I've added/updated the relevant documentation
|
|
17
|
+
- [ ] I've run `make lint` and `make format`
|
|
18
|
+
- [ ] I've made sure tests pass
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
name: Close inactive issues
|
|
2
|
+
on:
|
|
3
|
+
schedule:
|
|
4
|
+
- cron: "30 1 * * *"
|
|
5
|
+
|
|
6
|
+
jobs:
|
|
7
|
+
close-issues:
|
|
8
|
+
runs-on: ubuntu-latest
|
|
9
|
+
permissions:
|
|
10
|
+
issues: write
|
|
11
|
+
pull-requests: write
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/stale@v9
|
|
14
|
+
with:
|
|
15
|
+
days-before-issue-stale: 7
|
|
16
|
+
days-before-issue-close: 3
|
|
17
|
+
stale-issue-label: "stale"
|
|
18
|
+
stale-issue-message: "This issue is stale because it has been open for 7 days with no activity."
|
|
19
|
+
close-issue-message: "This issue was closed because it has been inactive for 3 days since being marked as stale."
|
|
20
|
+
days-before-pr-stale: -1
|
|
21
|
+
days-before-pr-close: -1
|
|
22
|
+
any-of-labels: 'question,needs-more-info'
|
|
23
|
+
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
# macOS Files
|
|
2
|
+
.DS_Store
|
|
3
|
+
|
|
4
|
+
# Byte-compiled / optimized / DLL files
|
|
5
|
+
__pycache__/
|
|
6
|
+
**/__pycache__/
|
|
7
|
+
*.py[cod]
|
|
8
|
+
*$py.class
|
|
9
|
+
|
|
10
|
+
# C extensions
|
|
11
|
+
*.so
|
|
12
|
+
|
|
13
|
+
# Distribution / packaging
|
|
14
|
+
.Python
|
|
15
|
+
build/
|
|
16
|
+
develop-eggs/
|
|
17
|
+
dist/
|
|
18
|
+
downloads/
|
|
19
|
+
eggs/
|
|
20
|
+
.eggs/
|
|
21
|
+
lib/
|
|
22
|
+
lib64/
|
|
23
|
+
parts/
|
|
24
|
+
sdist/
|
|
25
|
+
var/
|
|
26
|
+
wheels/
|
|
27
|
+
share/python-wheels/
|
|
28
|
+
*.egg-info/
|
|
29
|
+
.installed.cfg
|
|
30
|
+
*.egg
|
|
31
|
+
MANIFEST
|
|
32
|
+
|
|
33
|
+
# PyInstaller
|
|
34
|
+
*.manifest
|
|
35
|
+
*.spec
|
|
36
|
+
|
|
37
|
+
# Installer logs
|
|
38
|
+
pip-log.txt
|
|
39
|
+
pip-delete-this-directory.txt
|
|
40
|
+
|
|
41
|
+
# Unit test / coverage reports
|
|
42
|
+
htmlcov/
|
|
43
|
+
.tox/
|
|
44
|
+
.nox/
|
|
45
|
+
.coverage
|
|
46
|
+
.coverage.*
|
|
47
|
+
.cache
|
|
48
|
+
nosetests.xml
|
|
49
|
+
coverage.xml
|
|
50
|
+
*.cover
|
|
51
|
+
*.py,cover
|
|
52
|
+
.hypothesis/
|
|
53
|
+
.pytest_cache/
|
|
54
|
+
cover/
|
|
55
|
+
|
|
56
|
+
# Translations
|
|
57
|
+
*.mo
|
|
58
|
+
*.pot
|
|
59
|
+
|
|
60
|
+
# Django stuff:
|
|
61
|
+
*.log
|
|
62
|
+
local_settings.py
|
|
63
|
+
db.sqlite3
|
|
64
|
+
db.sqlite3-journal
|
|
65
|
+
|
|
66
|
+
# Flask stuff:
|
|
67
|
+
instance/
|
|
68
|
+
.webassets-cache
|
|
69
|
+
|
|
70
|
+
# Scrapy stuff:
|
|
71
|
+
.scrapy
|
|
72
|
+
|
|
73
|
+
# Sphinx documentation
|
|
74
|
+
docs/_build/
|
|
75
|
+
|
|
76
|
+
# PyBuilder
|
|
77
|
+
.pybuilder/
|
|
78
|
+
target/
|
|
79
|
+
|
|
80
|
+
# Jupyter Notebook
|
|
81
|
+
.ipynb_checkpoints
|
|
82
|
+
|
|
83
|
+
# IPython
|
|
84
|
+
profile_default/
|
|
85
|
+
ipython_config.py
|
|
86
|
+
|
|
87
|
+
# pdm
|
|
88
|
+
.pdm.toml
|
|
89
|
+
.pdm-python
|
|
90
|
+
.pdm-build/
|
|
91
|
+
|
|
92
|
+
# PEP 582
|
|
93
|
+
__pypackages__/
|
|
94
|
+
|
|
95
|
+
# Celery stuff
|
|
96
|
+
celerybeat-schedule
|
|
97
|
+
celerybeat.pid
|
|
98
|
+
|
|
99
|
+
# SageMath parsed files
|
|
100
|
+
*.sage.py
|
|
101
|
+
|
|
102
|
+
# Environments
|
|
103
|
+
.env
|
|
104
|
+
.venv
|
|
105
|
+
env/
|
|
106
|
+
venv/
|
|
107
|
+
ENV/
|
|
108
|
+
env.bak/
|
|
109
|
+
venv.bak/
|
|
110
|
+
.venv39
|
|
111
|
+
.venv_res
|
|
112
|
+
|
|
113
|
+
# Spyder project settings
|
|
114
|
+
.spyderproject
|
|
115
|
+
.spyproject
|
|
116
|
+
|
|
117
|
+
# Rope project settings
|
|
118
|
+
.ropeproject
|
|
119
|
+
|
|
120
|
+
# mkdocs documentation
|
|
121
|
+
/site
|
|
122
|
+
|
|
123
|
+
# mypy
|
|
124
|
+
.mypy_cache/
|
|
125
|
+
.dmypy.json
|
|
126
|
+
dmypy.json
|
|
127
|
+
|
|
128
|
+
# Pyre type checker
|
|
129
|
+
.pyre/
|
|
130
|
+
|
|
131
|
+
# pytype static type analyzer
|
|
132
|
+
.pytype/
|
|
133
|
+
|
|
134
|
+
# Cython debug symbols
|
|
135
|
+
cython_debug/
|
|
136
|
+
|
|
137
|
+
# PyCharm
|
|
138
|
+
#.idea/
|
|
139
|
+
|
|
140
|
+
# Ruff stuff:
|
|
141
|
+
.ruff_cache/
|
|
142
|
+
|
|
143
|
+
# PyPI configuration file
|
|
144
|
+
.pypirc
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: openai-agents
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.4
|
|
4
4
|
Summary: OpenAI Agents SDK
|
|
5
5
|
Project-URL: Homepage, https://github.com/openai/openai-agents-python
|
|
6
6
|
Project-URL: Repository, https://github.com/openai/openai-agents-python
|
|
@@ -19,7 +19,7 @@ Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
|
19
19
|
Classifier: Typing :: Typed
|
|
20
20
|
Requires-Python: >=3.9
|
|
21
21
|
Requires-Dist: griffe<2,>=1.5.6
|
|
22
|
-
Requires-Dist: openai>=1.66.
|
|
22
|
+
Requires-Dist: openai>=1.66.2
|
|
23
23
|
Requires-Dist: pydantic<3,>=2.10
|
|
24
24
|
Requires-Dist: requests<3,>=2.0
|
|
25
25
|
Requires-Dist: types-requests<3,>=2.0
|
|
@@ -30,16 +30,18 @@ Description-Content-Type: text/markdown
|
|
|
30
30
|
|
|
31
31
|
The OpenAI Agents SDK is a lightweight yet powerful framework for building multi-agent workflows.
|
|
32
32
|
|
|
33
|
-
<img src="docs/
|
|
33
|
+
<img src="https://cdn.openai.com/API/docs/images/orchestration.png" alt="Image of the Agents Tracing UI" style="max-height: 803px;">
|
|
34
34
|
|
|
35
35
|
### Core concepts:
|
|
36
36
|
|
|
37
|
-
1. [**Agents**](
|
|
38
|
-
2. [**Handoffs**](
|
|
39
|
-
3. [**Guardrails**](
|
|
40
|
-
4. [**Tracing**](
|
|
37
|
+
1. [**Agents**](https://openai.github.io/openai-agents-python/agents): LLMs configured with instructions, tools, guardrails, and handoffs
|
|
38
|
+
2. [**Handoffs**](https://openai.github.io/openai-agents-python/handoffs/): Allow agents to transfer control to other agents for specific tasks
|
|
39
|
+
3. [**Guardrails**](https://openai.github.io/openai-agents-python/guardrails/): Configurable safety checks for input and output validation
|
|
40
|
+
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
|
|
41
41
|
|
|
42
|
-
Explore the [examples](examples) directory to see the SDK in action.
|
|
42
|
+
Explore the [examples](examples) directory to see the SDK in action, and read our [documentation](https://openai.github.io/openai-agents-python/) for more details.
|
|
43
|
+
|
|
44
|
+
Notably, our SDK [is compatible](https://openai.github.io/openai-agents-python/models/) with any model providers that support the OpenAI Chat Completions API format.
|
|
43
45
|
|
|
44
46
|
## Get started
|
|
45
47
|
|
|
@@ -73,9 +75,11 @@ print(result.final_output)
|
|
|
73
75
|
|
|
74
76
|
(_If running this, ensure you set the `OPENAI_API_KEY` environment variable_)
|
|
75
77
|
|
|
78
|
+
(_For Jupyter notebook users, see [hello_world_jupyter.py](examples/basic/hello_world_jupyter.py)_)
|
|
79
|
+
|
|
76
80
|
## Handoffs example
|
|
77
81
|
|
|
78
|
-
```
|
|
82
|
+
```python
|
|
79
83
|
from agents import Agent, Runner
|
|
80
84
|
import asyncio
|
|
81
85
|
|
|
@@ -142,9 +146,9 @@ When you call `Runner.run()`, we run a loop until we get a final output.
|
|
|
142
146
|
|
|
143
147
|
1. We call the LLM, using the model and settings on the agent, and the message history.
|
|
144
148
|
2. The LLM returns a response, which may include tool calls.
|
|
145
|
-
3. If the response has a final output (see below for
|
|
149
|
+
3. If the response has a final output (see below for more on this), we return it and end the loop.
|
|
146
150
|
4. If the response has a handoff, we set the agent to the new agent and go back to step 1.
|
|
147
|
-
5. We process the tool calls (if any) and append the tool responses
|
|
151
|
+
5. We process the tool calls (if any) and append the tool responses messages. Then we go to step 1.
|
|
148
152
|
|
|
149
153
|
There is a `max_turns` parameter that you can use to limit the number of times the loop executes.
|
|
150
154
|
|
|
@@ -166,7 +170,7 @@ The Agents SDK is designed to be highly flexible, allowing you to model a wide r
|
|
|
166
170
|
|
|
167
171
|
## Tracing
|
|
168
172
|
|
|
169
|
-
The Agents SDK
|
|
173
|
+
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).
|
|
170
174
|
|
|
171
175
|
## Development (only needed if you need to edit the SDK/examples)
|
|
172
176
|
|
|
@@ -2,16 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
The OpenAI Agents SDK is a lightweight yet powerful framework for building multi-agent workflows.
|
|
4
4
|
|
|
5
|
-
<img src="docs/
|
|
5
|
+
<img src="https://cdn.openai.com/API/docs/images/orchestration.png" alt="Image of the Agents Tracing UI" style="max-height: 803px;">
|
|
6
6
|
|
|
7
7
|
### Core concepts:
|
|
8
8
|
|
|
9
|
-
1. [**Agents**](
|
|
10
|
-
2. [**Handoffs**](
|
|
11
|
-
3. [**Guardrails**](
|
|
12
|
-
4. [**Tracing**](
|
|
9
|
+
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
|
|
11
|
+
3. [**Guardrails**](https://openai.github.io/openai-agents-python/guardrails/): Configurable safety checks for input and output validation
|
|
12
|
+
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
|
|
13
13
|
|
|
14
|
-
Explore the [examples](examples) directory to see the SDK in action.
|
|
14
|
+
Explore the [examples](examples) directory to see the SDK in action, and read our [documentation](https://openai.github.io/openai-agents-python/) for more details.
|
|
15
|
+
|
|
16
|
+
Notably, our SDK [is compatible](https://openai.github.io/openai-agents-python/models/) with any model providers that support the OpenAI Chat Completions API format.
|
|
15
17
|
|
|
16
18
|
## Get started
|
|
17
19
|
|
|
@@ -45,9 +47,11 @@ print(result.final_output)
|
|
|
45
47
|
|
|
46
48
|
(_If running this, ensure you set the `OPENAI_API_KEY` environment variable_)
|
|
47
49
|
|
|
50
|
+
(_For Jupyter notebook users, see [hello_world_jupyter.py](examples/basic/hello_world_jupyter.py)_)
|
|
51
|
+
|
|
48
52
|
## Handoffs example
|
|
49
53
|
|
|
50
|
-
```
|
|
54
|
+
```python
|
|
51
55
|
from agents import Agent, Runner
|
|
52
56
|
import asyncio
|
|
53
57
|
|
|
@@ -114,9 +118,9 @@ When you call `Runner.run()`, we run a loop until we get a final output.
|
|
|
114
118
|
|
|
115
119
|
1. We call the LLM, using the model and settings on the agent, and the message history.
|
|
116
120
|
2. The LLM returns a response, which may include tool calls.
|
|
117
|
-
3. If the response has a final output (see below for
|
|
121
|
+
3. If the response has a final output (see below for more on this), we return it and end the loop.
|
|
118
122
|
4. If the response has a handoff, we set the agent to the new agent and go back to step 1.
|
|
119
|
-
5. We process the tool calls (if any) and append the tool responses
|
|
123
|
+
5. We process the tool calls (if any) and append the tool responses messages. Then we go to step 1.
|
|
120
124
|
|
|
121
125
|
There is a `max_turns` parameter that you can use to limit the number of times the loop executes.
|
|
122
126
|
|
|
@@ -138,7 +142,7 @@ The Agents SDK is designed to be highly flexible, allowing you to model a wide r
|
|
|
138
142
|
|
|
139
143
|
## Tracing
|
|
140
144
|
|
|
141
|
-
The Agents SDK
|
|
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).
|
|
142
146
|
|
|
143
147
|
## Development (only needed if you need to edit the SDK/examples)
|
|
144
148
|
|
|
@@ -13,6 +13,7 @@ The most common properties of an agent you'll configure are:
|
|
|
13
13
|
```python
|
|
14
14
|
from agents import Agent, ModelSettings, function_tool
|
|
15
15
|
|
|
16
|
+
@function_tool
|
|
16
17
|
def get_weather(city: str) -> str:
|
|
17
18
|
return f"The weather in {city} is sunny"
|
|
18
19
|
|
|
@@ -20,7 +21,7 @@ agent = Agent(
|
|
|
20
21
|
name="Haiku agent",
|
|
21
22
|
instructions="Always respond in haiku form",
|
|
22
23
|
model="o3-mini",
|
|
23
|
-
tools=[
|
|
24
|
+
tools=[get_weather],
|
|
24
25
|
)
|
|
25
26
|
```
|
|
26
27
|
|
|
@@ -10,14 +10,14 @@ from agents import set_default_openai_key
|
|
|
10
10
|
set_default_openai_key("sk-...")
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
Alternatively, you can also configure an OpenAI client to be used. By default, the SDK creates an `AsyncOpenAI` instance, using the API key from the environment variable or the default key set above. You can
|
|
13
|
+
Alternatively, you can also configure an OpenAI client to be used. By default, the SDK creates an `AsyncOpenAI` instance, using the API key from the environment variable or the default key set above. You can change this by using the [set_default_openai_client()][agents.set_default_openai_client] function.
|
|
14
14
|
|
|
15
15
|
```python
|
|
16
16
|
from openai import AsyncOpenAI
|
|
17
17
|
from agents import set_default_openai_client
|
|
18
18
|
|
|
19
19
|
custom_client = AsyncOpenAI(base_url="...", api_key="...")
|
|
20
|
-
set_default_openai_client(
|
|
20
|
+
set_default_openai_client(custom_client)
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
Finally, you can also customize the OpenAI API that is used. By default, we use the OpenAI Responses API. You can override this to use the Chat Completions API by using the [set_default_openai_api()][agents.set_default_openai_api] function.
|
|
@@ -36,6 +36,7 @@ class UserInfo: # (1)!
|
|
|
36
36
|
name: str
|
|
37
37
|
uid: int
|
|
38
38
|
|
|
39
|
+
@function_tool
|
|
39
40
|
async def fetch_user_age(wrapper: RunContextWrapper[UserInfo]) -> str: # (2)!
|
|
40
41
|
return f"User {wrapper.context.name} is 47 years old"
|
|
41
42
|
|
|
@@ -44,7 +45,7 @@ async def main():
|
|
|
44
45
|
|
|
45
46
|
agent = Agent[UserInfo]( # (4)!
|
|
46
47
|
name="Assistant",
|
|
47
|
-
tools=[
|
|
48
|
+
tools=[fetch_user_age],
|
|
48
49
|
)
|
|
49
50
|
|
|
50
51
|
result = await Runner.run(
|
|
@@ -21,7 +21,7 @@ Input guardrails run in 3 steps:
|
|
|
21
21
|
|
|
22
22
|
## Output guardrails
|
|
23
23
|
|
|
24
|
-
Output
|
|
24
|
+
Output guardrails run in 3 steps:
|
|
25
25
|
|
|
26
26
|
1. First, the guardrail receives the same input passed to the agent.
|
|
27
27
|
2. Next, the guardrail function runs to produce a [`GuardrailFunctionOutput`][agents.guardrail.GuardrailFunctionOutput], which is then wrapped in an [`OutputGuardrailResult`][agents.guardrail.OutputGuardrailResult]
|
|
@@ -33,7 +33,7 @@ Output guardrailas run in 3 steps:
|
|
|
33
33
|
|
|
34
34
|
## Tripwires
|
|
35
35
|
|
|
36
|
-
If the input or output fails the guardrail, the Guardrail can signal this with a tripwire. As soon as we see a
|
|
36
|
+
If the input or output fails the guardrail, the Guardrail can signal this with a tripwire. As soon as we see a guardrail that has triggered the tripwires, we immediately raise a `{Input,Output}GuardrailTripwireTriggered` exception and halt the Agent execution.
|
|
37
37
|
|
|
38
38
|
## Implementing a guardrail
|
|
39
39
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# OpenAI Agents SDK
|
|
2
2
|
|
|
3
|
-
The OpenAI Agents SDK enables you to build agentic AI apps in a lightweight, easy
|
|
3
|
+
The [OpenAI Agents SDK](https://github.com/openai/openai-agents-python) enables you to build agentic AI apps in a lightweight, easy-to-use package with very few abstractions. It's a production-ready upgrade of our previous experimentation for agents, [Swarm](https://github.com/openai/swarm/tree/main). The Agents SDK has a very small set of primitives:
|
|
4
4
|
|
|
5
5
|
- **Agents**, which are LLMs equipped with instructions and tools
|
|
6
6
|
- **Handoffs**, which allow agents to delegate to other agents for specific tasks
|
|
7
7
|
- **Guardrails**, which enable the inputs to agents to be validated
|
|
8
8
|
|
|
9
|
-
In combination with Python, these primitives are powerful enough to express complex relationships between tools and agents, and allow you to build real
|
|
9
|
+
In combination with Python, these primitives are powerful enough to express complex relationships between tools and agents, and allow you to build real-world applications without a steep learning curve. In addition, the SDK comes with built-in **tracing** that lets you visualize and debug your agentic flows, as well as evaluate them and even fine-tune models for your application.
|
|
10
10
|
|
|
11
11
|
## Why use the Agents SDK
|
|
12
12
|
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# Models
|
|
2
|
+
|
|
3
|
+
The Agents SDK comes with out-of-the-box support for OpenAI models in two flavors:
|
|
4
|
+
|
|
5
|
+
- **Recommended**: the [`OpenAIResponsesModel`][agents.models.openai_responses.OpenAIResponsesModel], which calls OpenAI APIs using the new [Responses API](https://platform.openai.com/docs/api-reference/responses).
|
|
6
|
+
- The [`OpenAIChatCompletionsModel`][agents.models.openai_chatcompletions.OpenAIChatCompletionsModel], which calls OpenAI APIs using the [Chat Completions API](https://platform.openai.com/docs/api-reference/chat).
|
|
7
|
+
|
|
8
|
+
## Mixing and matching models
|
|
9
|
+
|
|
10
|
+
Within a single workflow, you may want to use different models for each agent. For example, you could use a smaller, faster model for triage, while using a larger, more capable model for complex tasks. When configuring an [`Agent`][agents.Agent], you can select a specific model by either:
|
|
11
|
+
|
|
12
|
+
1. Passing the name of an OpenAI model.
|
|
13
|
+
2. Passing any model name + a [`ModelProvider`][agents.models.interface.ModelProvider] that can map that name to a Model instance.
|
|
14
|
+
3. Directly providing a [`Model`][agents.models.interface.Model] implementation.
|
|
15
|
+
|
|
16
|
+
!!!note
|
|
17
|
+
|
|
18
|
+
While our SDK supports both the [`OpenAIResponsesModel`][agents.models.openai_responses.OpenAIResponsesModel] and the [`OpenAIChatCompletionsModel`][agents.models.openai_chatcompletions.OpenAIChatCompletionsModel] shapes, we recommend using a single model shape for each workflow because the two shapes support a different set of features and tools. If your workflow requires mixing and matching model shapes, make sure that all the features you're using are available on both.
|
|
19
|
+
|
|
20
|
+
```python
|
|
21
|
+
from agents import Agent, Runner, AsyncOpenAI, OpenAIChatCompletionsModel
|
|
22
|
+
import asyncio
|
|
23
|
+
|
|
24
|
+
spanish_agent = Agent(
|
|
25
|
+
name="Spanish agent",
|
|
26
|
+
instructions="You only speak Spanish.",
|
|
27
|
+
model="o3-mini", # (1)!
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
english_agent = Agent(
|
|
31
|
+
name="English agent",
|
|
32
|
+
instructions="You only speak English",
|
|
33
|
+
model=OpenAIChatCompletionsModel( # (2)!
|
|
34
|
+
model="gpt-4o",
|
|
35
|
+
openai_client=AsyncOpenAI()
|
|
36
|
+
),
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
triage_agent = Agent(
|
|
40
|
+
name="Triage agent",
|
|
41
|
+
instructions="Handoff to the appropriate agent based on the language of the request.",
|
|
42
|
+
handoffs=[spanish_agent, english_agent],
|
|
43
|
+
model="gpt-3.5-turbo",
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
async def main():
|
|
47
|
+
result = await Runner.run(triage_agent, input="Hola, ¿cómo estás?")
|
|
48
|
+
print(result.final_output)
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
1. Sets the name of an OpenAI model directly.
|
|
52
|
+
2. Provides a [`Model`][agents.models.interface.Model] implementation.
|
|
53
|
+
|
|
54
|
+
## Using other LLM providers
|
|
55
|
+
|
|
56
|
+
You can use other LLM providers in 3 ways (examples [here](https://github.com/openai/openai-agents-python/tree/main/examples/model_providers/)):
|
|
57
|
+
|
|
58
|
+
1. [`set_default_openai_client`][agents.set_default_openai_client] is useful in cases where you want to globally use an instance of `AsyncOpenAI` as the LLM client. This is for cases where the LLM provider has an OpenAI compatible API endpoint, and you can set the `base_url` and `api_key`. See a configurable example in [examples/model_providers/custom_example_global.py](https://github.com/openai/openai-agents-python/tree/main/examples/model_providers/custom_example_global.py).
|
|
59
|
+
2. [`ModelProvider`][agents.models.interface.ModelProvider] is at the `Runner.run` level. This lets you say "use a custom model provider for all agents in this run". See a configurable example in [examples/model_providers/custom_example_provider.py](https://github.com/openai/openai-agents-python/tree/main/examples/model_providers/custom_example_provider.py).
|
|
60
|
+
3. [`Agent.model`][agents.agent.Agent.model] lets you specify the model on a specific Agent instance. This enables you to mix and match different providers for different agents. See a configurable example in [examples/model_providers/custom_example_agent.py](https://github.com/openai/openai-agents-python/tree/main/examples/model_providers/custom_example_agent.py).
|
|
61
|
+
|
|
62
|
+
In cases where you do not have an API key from `platform.openai.com`, we recommend disabling tracing via `set_tracing_disabled()`, or setting up a [different tracing processor](tracing.md).
|
|
63
|
+
|
|
64
|
+
!!! note
|
|
65
|
+
|
|
66
|
+
In these examples, we use the Chat Completions API/model, because most LLM providers don't yet support the Responses API. If your LLM provider does support it, we recommend using Responses.
|
|
@@ -27,11 +27,11 @@ This pattern is great when the task is open-ended and you want to rely on the in
|
|
|
27
27
|
|
|
28
28
|
## Orchestrating via code
|
|
29
29
|
|
|
30
|
-
While orchestrating via LLM is powerful, orchestrating via
|
|
30
|
+
While orchestrating via LLM is powerful, orchestrating via code makes tasks more deterministic and predictable, in terms of speed, cost and performance. Common patterns here are:
|
|
31
31
|
|
|
32
32
|
- Using [structured outputs](https://platform.openai.com/docs/guides/structured-outputs) to generate well formed data that you can inspect with your code. For example, you might ask an agent to classify the task into a few categories, and then pick the next agent based on the category.
|
|
33
33
|
- Chaining multiple agents by transforming the output of one into the input of the next. You can decompose a task like writing a blog post into a series of steps - do research, write an outline, write the blog post, critique it, and then improve it.
|
|
34
34
|
- Running the agent that performs the task in a `while` loop with an agent that evaluates and provides feedback, until the evaluator says the output passes certain criteria.
|
|
35
35
|
- Running multiple agents in parallel, e.g. via Python primitives like `asyncio.gather`. This is useful for speed when you have multiple tasks that don't depend on each other.
|
|
36
36
|
|
|
37
|
-
We have a number of examples in [`examples/agent_patterns`](https://github.com/openai/openai-agents-python/examples/agent_patterns).
|
|
37
|
+
We have a number of examples in [`examples/agent_patterns`](https://github.com/openai/openai-agents-python/tree/main/examples/agent_patterns).
|
|
@@ -166,6 +166,9 @@ triage_agent = Agent(
|
|
|
166
166
|
)
|
|
167
167
|
|
|
168
168
|
async def main():
|
|
169
|
+
result = await Runner.run(triage_agent, "who was the first president of the united states?")
|
|
170
|
+
print(result.final_output)
|
|
171
|
+
|
|
169
172
|
result = await Runner.run(triage_agent, "what is life")
|
|
170
173
|
print(result.final_output)
|
|
171
174
|
|
|
@@ -32,7 +32,7 @@ The [`new_items`][agents.result.RunResultBase.new_items] property contains the n
|
|
|
32
32
|
|
|
33
33
|
- [`MessageOutputItem`][agents.items.MessageOutputItem] indicates a message from the LLM. The raw item is the message generated.
|
|
34
34
|
- [`HandoffCallItem`][agents.items.HandoffCallItem] indicates that the LLM called the handoff tool. The raw item is the tool call item from the LLM.
|
|
35
|
-
- [`HandoffOutputItem`][agents.items.HandoffOutputItem] indicates that a handoff
|
|
35
|
+
- [`HandoffOutputItem`][agents.items.HandoffOutputItem] indicates that a handoff occurred. The raw item is the tool response to the handoff tool call. You can also access the source/target agents from the item.
|
|
36
36
|
- [`ToolCallItem`][agents.items.ToolCallItem] indicates that the LLM invoked a tool.
|
|
37
37
|
- [`ToolCallOutputItem`][agents.items.ToolCallOutputItem] indicates that a tool was called. The raw item is the tool response. You can also access the tool output from the item.
|
|
38
38
|
- [`ReasoningItem`][agents.items.ReasoningItem] indicates a reasoning item from the LLM. The raw item is the reasoning generated.
|
|
@@ -78,7 +78,7 @@ async def main():
|
|
|
78
78
|
# San Francisco
|
|
79
79
|
|
|
80
80
|
# Second turn
|
|
81
|
-
new_input =
|
|
81
|
+
new_input = result.to_input_list() + [{"role": "user", "content": "What state is it in?"}]
|
|
82
82
|
result = await Runner.run(agent, new_input)
|
|
83
83
|
print(result.final_output)
|
|
84
84
|
# California
|
|
@@ -16,7 +16,7 @@ The Agents SDK includes built-in tracing, collecting a comprehensive record of e
|
|
|
16
16
|
- `trace_id`: A unique ID for the trace. Automatically generated if you don't pass one. Must have the format `trace_<32_alphanumeric>`.
|
|
17
17
|
- `group_id`: Optional group ID, to link multiple traces from the same conversation. For example, you might use a chat thread ID.
|
|
18
18
|
- `disabled`: If True, the trace will not be recorded.
|
|
19
|
-
- `metadata`:
|
|
19
|
+
- `metadata`: Optional metadata for the trace.
|
|
20
20
|
- **Spans** represent operations that have a start and end time. Spans have:
|
|
21
21
|
- `started_at` and `ended_at` timestamps.
|
|
22
22
|
- `trace_id`, to represent the trace they belong to
|
|
@@ -50,7 +50,7 @@ async def main():
|
|
|
50
50
|
|
|
51
51
|
with trace("Joke workflow"): # (1)!
|
|
52
52
|
first_result = await Runner.run(agent, "Tell me a joke")
|
|
53
|
-
second_result = await Runner.run(agent, f"Rate this joke: {
|
|
53
|
+
second_result = await Runner.run(agent, f"Rate this joke: {first_result.final_output}")
|
|
54
54
|
print(f"Joke: {first_result.final_output}")
|
|
55
55
|
print(f"Rating: {second_result.final_output}")
|
|
56
56
|
```
|
|
@@ -93,3 +93,5 @@ External trace processors include:
|
|
|
93
93
|
- [Braintrust](https://braintrust.dev/docs/guides/traces/integrations#openai-agents-sdk)
|
|
94
94
|
- [Pydantic Logfire](https://logfire.pydantic.dev/docs/integrations/llms/openai/#openai-agents)
|
|
95
95
|
- [AgentOps](https://docs.agentops.ai/v1/integrations/agentssdk)
|
|
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)
|
|
@@ -51,4 +51,4 @@ You can definitely do this without any special Agents SDK features by using para
|
|
|
51
51
|
|
|
52
52
|
This is really useful for latency: for example, you might have a very fast model that runs the guardrail and a slow model that runs the actual agent. You wouldn't want to wait for the slow model to finish, so guardrails let you quickly reject invalid inputs.
|
|
53
53
|
|
|
54
|
-
See the [`
|
|
54
|
+
See the [`input_guardrails.py`](./input_guardrails.py) and [`output_guardrails.py`](./output_guardrails.py) files for examples.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
from agents import Agent, Runner
|
|
2
|
+
|
|
3
|
+
agent = Agent(name="Assistant", instructions="You are a helpful assistant")
|
|
4
|
+
|
|
5
|
+
# 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
|
|
7
|
+
print(result.final_output)
|
|
8
|
+
|
|
9
|
+
# Code within code loops,
|
|
10
|
+
# Infinite mirrors reflect—
|
|
11
|
+
# Logic folds on self.
|