---
type: email
from: Br1an <notifications@github.com>
subject: [openai/openai-agents-python] feat: expose `tool_call_id` on

 `RunResult` for agent-as-tool pattern (PR #2562)
received: 2026-03-06 00:41:39
priority: high
status: awaiting_approval
---

## Email Content
### Summary



Add a read-only `tool_call_id` property to `RunResultBase` so that `custom_output_extractor` callbacks can access the parent tool call ID in the agent-as-tool pattern.



Currently, when using `Agent.as_tool()` with a `custom_output_extractor`, the extractor receives a `RunResult` whose `context_wrapper` is actually a `ToolContext` containing `tool_call_id`. However, `context_wrapper` is typed as `RunContextWrapper[Any]`, so users must perform an `isinstance` check to access it. The new `tool_call_id` property provides a clean, discoverable API that returns the ID directly (or `None` when the run was not started via `as_tool()`).



### Test plan



- Added unit tests in `tests/test_result_cast.py`:

  - `test_tool_call_id_returns_id_when_context_is_tool_context` � verifies ...

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