fix(typing): explicitly specialize ToolContext[Any] in ToolFunctionWithToolContext · Issue #5387 · openai/openai-agents-python · GitHub
Skip to content

fix(typing): explicitly specialize ToolContext[Any] in ToolFunctionWithToolContext #5387

Open

Description

@MuneebMalik244535

Description & Motivation

In src/agents/tool.py, ToolFunctionWithToolContext is defined with an unspecialized ToolContext:

ToolFunctionWithoutContext = Callable[ToolParams, Any]
ToolFunctionWithContext = Callable[Concatenate[RunContextWrapper[Any], ToolParams], Any]
ToolFunctionWithToolContext = Callable[Concatenate[ToolContext, ToolParams], Any]

Activity

  1. AbarnaaSree commented on Oct 18, 2026

    @AbarnaaSree

    Hi, I’d like to work on this issue. Would it be okay if I update ToolFunctionWithToolContext to explicitly use ToolContext[Any], check for any related typing inconsistencies, and add or update tests to ensure the change preserves existing type-checking behavior? I’ll keep the change focused and run the relevant tests and type checks before submitting a PR.

  2. MuneebMalik244535 commented on Oct 18, 2026

    @MuneebMalik244535
    Author

    Hi @AbarnaaSree, thanks for reaching out!

    Just to clarify, the complete fix and regression test have already been implemented, fully tested, and linked in the issue description above:

    Also note that per this repository's CONTRIBUTING.md, pull requests are currently limited to repository collaborators. We are currently waiting for a maintainer to review the RCA and either cherry-pick the linked commit or open a collaborator PR.

    Thanks!

  3. AbarnaaSree commented on Oct 18, 2026

    @AbarnaaSree

    Thanks for clarifying! I understand that the fix and regression test are already implemented and awaiting maintainer review. I’ll avoid duplicating the work and would be happy to help review the proposed changes or validate any additional edge cases if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions