Skip to content

Add run configuration inheritance for agent-as-tool workflows #1006

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 20 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
800d6fd
Maintain existing functionality for storing run_config in trace context
DanielHashmi Jul 4, 2025
9ed72e7
Add run_config inheritance for agent-as-tool functionality
DanielHashmi Jul 4, 2025
78c94dc
Add _run_config attribute to trace classes
DanielHashmi Jul 4, 2025
a547140
Merge branch 'openai:main' into config-with-agent-as-tool
DanielHashmi Jul 9, 2025
e90e48d
Consolidate to one logger
DanielHashmi Jul 9, 2025
20bbe10
Enable RunConfig inheritance in as_tool() method
DanielHashmi Jul 9, 2025
878c7a6
Add RunConfig inheritance with pass_run_config_to_sub_agents flag
DanielHashmi Jul 9, 2025
e04462f
Add RunConfig inheritance with pass_run_config_to_sub_agents flag
DanielHashmi Jul 9, 2025
24c2b1e
Enable RunConfig inheritance in as_tool() method
DanielHashmi Jul 9, 2025
f83f5f1
Add RunConfig context variable management to Scope class
DanielHashmi Jul 9, 2025
f3a6fe0
Add RunConfig inheritance tests with error handling coverage
DanielHashmi Jul 9, 2025
87f88e3
Update test_run_config_inheritance.py
DanielHashmi Jul 10, 2025
7bf5202
Update agent.py
DanielHashmi Jul 10, 2025
97b4f9a
Update run.py
DanielHashmi Jul 10, 2025
8ac4b44
Adding scope and span_data doc strings (#463)
DanielHashmi Jul 10, 2025
e5dfa78
Merge branch 'main' into config-with-agent-as-tool
DanielHashmi Jul 16, 2025
840d00e
Update test_run_config_inheritance.py
DanielHashmi Jul 16, 2025
3f186f0
Update agent.py
DanielHashmi Jul 16, 2025
b722b70
Update run.py
DanielHashmi Jul 16, 2025
191a34e
Update agent.py
DanielHashmi Jul 16, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/agents/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,12 +256,16 @@ def as_tool(
description_override=tool_description or "",
)
async def run_agent(context: RunContextWrapper, input: str) -> str:
from .run import Runner
from .run import Runner, get_current_run_config

# Get the current run_config from context if available
current_run_config = get_current_run_config()

output = await Runner.run(
starting_agent=self,
input=input,
context=context.context,
run_config=current_run_config, # Pass inherited config
)
if custom_output_extractor:
return await custom_output_extractor(output)
Expand Down
Loading