Repository navigation
Python: Filter caller options in hosting-responses README example - #9360
Merged
Eduard van Valkenburg (eavanvalkenburg) merged 1 commit intoOct 14, 2026
Conversation
The README route passed every caller-supplied Responses body field from responses_to_run() straight to agent.run(). Apps copying it let callers set tools, instructions, or additional_function_arguments, which override app-owned tool kwargs. Allowlist request options the same way the local_responses samples already do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Benjamin Schäublin (bschaeublin)
deployed
to
github-app-auth
October 13, 2026 20:27 — with
GitHub Actions
Active
Benjamin Schäublin (bschaeublin)
marked this pull request as ready for review
October 13, 2026 20:28
Benjamin Schäublin (bschaeublin)
requested review from
SergeyMenshykh,
Tao Chen (TaoChenOSU),
Eduard van Valkenburg (eavanvalkenburg),
Giles Odigwe (giles17),
Jose Alvarez (jpalvarezl),
Evan Mattson (moonbox3),
Roger Barreto (rogerbarreto),
sophia-ramsey and
westey (westey-m)
as code owners
October 13, 2026 20:28
Benjamin Schäublin (bschaeublin)
deployed
to
github-app-auth
October 13, 2026 20:35 — with
GitHub Actions
Active
Benjamin Schäublin (bschaeublin)
deployed
to
github-app-auth
October 13, 2026 20:35 — with
GitHub Actions
Active
Benjamin Schäublin (bschaeublin)
deployed
to
github-app-auth
October 13, 2026 20:35 — with
GitHub Actions
Active
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The documentation example now consistently applies the established sample allowlist without introducing functional issues.
0 open findings
What changed in this PR
Updates the hosting-responses README example to safely filter caller-controlled agent options.
Changes:
- Adds an allowlist matching existing hosting samples.
- Passes only permitted options to
agent.run().
| File | Description |
|---|---|
python/packages/hosting-responses/README.md |
Demonstrates deny-by-default request option filtering. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Eduard van Valkenburg (eavanvalkenburg)
approved these changes
Oct 14, 2026
Benjamin Schäublin (bschaeublin)
deleted the
docs/hosting-responses-option-allowlist
branch
October 14, 2026 09:29
This branch was successfully deployed
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
responses_to_run()copies every caller-supplied Responses body field intooptions, and its docstring leaves it to app-owned route code to decide which options to pass toagent.run(...). The shippedlocal_responsesandlocal_responses_harnesssamples do this with anALLOWED_REQUEST_OPTIONSallowlist, but theagent-framework-hosting-responsesREADME example passedrun["options"]straight through.An app built from that example lets callers set
tools,instructions, oradditional_function_arguments. The last one overrides app-bound tool kwargs, such as auser_idthe app derives from authentication.Description & Review Guide
run["options"]through the sameALLOWED_REQUEST_OPTIONS = frozenset({"max_tokens", "reasoning"})allowlist thatsamples/04-hosting/af-hosting/local_responses/app.pyuses.responses_to_run()already remapsmax_output_tokenstomax_tokens.Related Issue
N/A - trivial change: makes the README example consistent with the shipped
local_responsessample, which already filters caller options with the same allowlist. The README was the only example passingrun["options"]through unfiltered.AI Assistance
AI assistance details: Claude Code helped identify the inconsistency, prepare the README change, and draft this description. I checked the before and after behaviour locally against the published
agent-framework-core1.21.0 andagent-framework-hosting-responses1.0.0a261008 packages.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.🤖 Generated with Claude Code