---
type: email
from: Kazuhiro Sera <notifications@github.com>
subject: [openai/openai-agents-python] feat: #2247 add RunResult tool_context

 accessor for agent tools (PR #2575)
received: 2026-03-05 23:58:03
priority: high
status: awaiting_approval
---

## Email Content
This pull request adds a typed `RunResult.tool_context` convenience accessor for nested agent-tool runs so `custom_output_extractor` implementations can inspect `ToolContext` metadata without a cast. The change keeps the existing `RunResult` and `RunResultStreaming` constructor shapes intact by adding the accessor on the shared `RunResultBase`, which keeps the release risk low while improving mypy ergonomics for agent-as-tool integrations.



It also updates the agent-as-tool tests to cover both non-streaming and streaming extractor access to `tool_context`, and documents the new extractor pattern in `docs/tools.md`. Behavior is unchanged for normal runs: `tool_context` is `None` unless the run was started through `Agent.as_tool(...)`.



Resolves #2247 

You can view, comment on, or merge...

## Suggested Actions
- [ ] Reply
- [ ] Archive
- [ ] Flag for review
