Skip to content

Python: expose provider call IDs on FunctionInvocationContext - #10047

Open
Daniel Quintas (danielquintas8) wants to merge 1 commit into
microsoft:mainfrom
danielquintas8:feature/function-call-id
Open

Daniel Quintas (danielquintas8) wants to merge 1 commit into
microsoft:mainfrom
danielquintas8:feature/function-call-id

Conversation

@danielquintas8

Copy link
Copy Markdown

Motivation & Context

A tool proxy needs the provider call ID to correlate an execution with the recorded call and its result. The automatic Python loop currently exposes that ID only through an undocumented metadata key on the function-middleware path. A context-aware tool otherwise has no supported property for it.

Description & Review Guide

What are the major changes? Add the read-only FunctionInvocationContext.call_id property. Bind it before function middleware and before the tool body executes. Standalone FunctionTool.invoke calls use their existing tool_call_id argument; omitting it yields None, including when a context is reused. The existing middleware metadata keys remain available.

What is the impact of these changes? Tools can read the provider ID without installing pass-through middleware. The property exposes the ID alone. Call payloads are not copied, and ID generation, call/result pairing, and argument handling retain their existing paths. Local validation passed the package build, 9,330 core tests, syntax checks, strict source Pyright, and all five test type checkers. Local code review and adversarial review passed with no findings. Credential-dependent integration tests were not run.

What do you want reviewers to focus on? Check whether this narrow property is the right public API, and whether binding it at middleware dispatch and invocation covers the intended execution paths. The design is a proposal; I can change its shape or wiring to follow the core team's direction.

Related Issue

Fixes #9454

The issue remains in planning; explicit implementation agreement has not been recorded. This PR offers a concrete proposal for that discussion.

AI Assistance

  • No material AI assistance was used.
  • This is an AI-assisted contribution. I reviewed, understood, and verified all submitted content and accept responsibility for it.

AI assistance details: design, implementation, regression tests, documentation, and this PR description.

Contribution Checklist

  • The code builds clean without any errors or warnings
  • All unit tests pass, and I have added new tests where possible
  • The PR follows the Contribution Guidelines
  • This PR links to an agreed issue with no competing open PR, or the Related Issue section documents a trivial-change or repository-automation exception.
  • This is not a breaking change. If it is a breaking change, add the breaking change label (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.

Copilot AI balanced review requested due to automatic review settings November 3, 2026 15:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@danielquintas8

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

This branch was successfully deployed

No deployments
github-app-auth — ea8d8696 Deployed Nov 3, 2026 by danielquintas8 via team_check #8598
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Usage: [Issues, PRs], Target: documentation in the code base and learn docs python Usage: [Issues, PRs], Target: Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python: [Feature]: Expose the tool call's id on FunctionInvocationContext on every execution path

2 participants