Skip to content

Commit 177d11a

Browse files
committed
fix the issue reported by #2230 (comment)
1 parent fcc21a6 commit 177d11a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/agents/agent.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,12 @@ async def run_agent(context: ToolContext, input: str) -> Any:
479479
from .tool_context import ToolContext
480480

481481
resolved_max_turns = max_turns if max_turns is not None else DEFAULT_MAX_TURNS
482-
nested_context = context if isinstance(context, RunContextWrapper) else context
482+
if isinstance(context, ToolContext):
483+
nested_context = context
484+
elif isinstance(context, RunContextWrapper):
485+
nested_context = context.context
486+
else:
487+
nested_context = context
483488
run_result: RunResult | RunResultStreaming
484489

485490
if on_stream is not None:

0 commit comments

Comments
 (0)