Python: feat: forward function_invocation_kwargs through DevUI to agent.run - #7779
Merged
Evan Mattson (moonbox3) merged 4 commits intoAug 21, 2026
Conversation
…nt.run
DevUI's /v1/responses endpoint builds agent.run() kwargs by hand and only
passed stream/session, so tools that read request-scoped values via
FunctionInvocationContext.kwargs (tenant id, auth token, user id)
silently received nothing when the agent was run through DevUI. The same
agent works correctly outside DevUI via agent.run(..., function_invocation_kwargs=...).
Forward function_invocation_kwargs from the request into agent.run() in
AgentFrameworkExecutor._execute_agent. Accepts both channels already used
on the request payload:
- extra_body.function_invocation_kwargs (the channel already used for
response_id / checkpoint_id)
- top-level extra field (AgentFrameworkRequest has ConfigDict(extra="allow"))
Top-level takes precedence when both are set. Non-dict / missing values
are silently ignored for backward compatibility. No frontend / model
changes.
Adds a parametrized regression test in test_execution.py covering all
three cases (extra_body, top-level, absent).
Fixes microsoft#7344
Manjunath Janardhan (manjunathshiva)
temporarily deployed
to
github-app-auth
August 20, 2026 09:07 — with
GitHub Actions
Inactive
Manjunath Janardhan (manjunathshiva)
temporarily deployed
to
github-app-auth
August 20, 2026 09:07 — with
GitHub Actions
Inactive
Manjunath Janardhan (manjunathshiva)
temporarily deployed
to
github-app-auth
August 20, 2026 09:07 — with
GitHub Actions
Inactive
Manjunath Janardhan (manjunathshiva)
temporarily deployed
to
github-app-auth
August 20, 2026 09:08 — with
GitHub Actions
Inactive
Copilot started reviewing on behalf of
Manjunath Janardhan (manjunathshiva)
August 20, 2026 09:08
View session
Contributor
There was a problem hiding this comment.
Pull request overview
Forwards request-scoped function invocation arguments from DevUI requests to agent tool invocations.
Changes:
- Supports nested and top-level
function_invocation_kwargs. - Adds regression coverage for both channels and omitted values.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
python/packages/devui/agent_framework_devui/_executor.py |
Forwards validated invocation kwargs to agent.run(). |
python/packages/devui/tests/devui/test_execution.py |
Tests forwarding and absence behavior. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Manjunath Janardhan (manjunathshiva)
marked this pull request as ready for review
August 20, 2026 09:11
Manjunath Janardhan (manjunathshiva)
temporarily deployed
to
github-app-auth
August 20, 2026 09:11 — with
GitHub Actions
Inactive
Manjunath Janardhan (manjunathshiva)
deployed
to
github-app-auth
August 20, 2026 11:46 — with
GitHub Actions
Active
Manjunath Janardhan (manjunathshiva)
deployed
to
github-app-auth
August 20, 2026 16:25 — with
GitHub Actions
Active
Manjunath Janardhan (manjunathshiva)
deployed
to
github-app-auth
August 21, 2026 04:08 — with
GitHub Actions
Active
Evan Mattson (moonbox3)
approved these changes
Aug 21, 2026
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation & Context
DevUI builds the kwargs passed to
agent.run()by hand and only forwardsstreamandsession, so tools that read request-scoped values viaFunctionInvocationContext.kwargs(tenant id, auth token, user id) silently receive nothing when the agent is run through DevUI.The same agent works correctly outside DevUI via a direct
agent.run(..., function_invocation_kwargs=...)call. Parity matters when agents are first developed / debugged in DevUI before being promoted to a real deployment.Fixes #7344.
Description & Review Guide
Two prior attempts exist for this issue (#7352 and #7355); both were closed by their authors (one a literal duplicate of the other) without maintainer review. This PR takes the smaller of the two approaches:
What are the major changes?
_executor.py(_execute_agent): readfunction_invocation_kwargsfrom the request and merge it into the kwargs passed toagent.run(). Accepts both channels already present on the request payload:extra_body.function_invocation_kwargs— the channel already used forresponse_idandcheckpoint_idin this fileAgentFrameworkRequesthasmodel_config = ConfigDict(extra="allow"), so a top-levelfunction_invocation_kwargskey was already accepted (and silently dropped, which is what the issue reporter originally tried)tests/devui/test_execution.py: parametrized regression test asserting the kwarg reachesrun()via both channels, and is not forwarded at all when absent.What is the impact of these changes?
AgentFrameworkRequestmodel change, no frontend changes — only the existing DevUI/v1/responsesagent execution path gains forwarding behavior. When the field is absent, behavior is unchanged.What do you want reviewers to focus on?
extra_body.function_invocation_kwargsand a top-levelmodel_extrafield is desired, orextra_bodyalone (the priorextra_body-only attempt in Python: Forward function_invocation_kwargs through DevUI to agent.run… #7352 may be what maintainers prefer; easy to narrow)._execute_workflow) — intentionally left out of this PR since the issue is specifically about per-tool invocation context on the agent path.Related Issue
Fixes #7344
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.