Repository navigation
fix(tool): inject bound API keys into imported OpenAPI calls - #134
Merged
Sunrisea merged 1 commit intoOct 20, 2026
Merged
Conversation
Signed-off-by: 濯光 <zhuoguang.zt@alibaba-inc.com>
hanxie-crypto
approved these changes
Oct 20, 2026
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.
Imported FunctionCall tools retain a bound
credentialNamein the control plane, but the Python SDK never resolves it when calling the external API. An API requiringX-API-Keytherefore receives no credential unless callers embed the secret in the OpenAPI spec or pass headers themselves.This change declares
Tool.credential_nameand resolves bound API key credentials on eachFUNCTIONCALL/OPENAPI_IMPORTinvocation, using the effective request configuration. It injectsheaderKey(defaultX-API-Key) with the exactprefix + secretvalue, including an empty prefix, and merges header names case-insensitively. Lookup failures, empty secrets, and unsupported credential types stop the request. Existing fixed-header precedence, unbound tools, and code-package invocation behavior are preserved. The sync implementation is regenerated from the async template.Validation:
uv run --no-sync mypy --config-file mypy.ini .: no issues in 376 source files. Changed files pass Pyink and whitespace checks.google-adk 2.12.0,langchain 1.4.6, andag-ui-protocol 1.0.0in the existing virtual environment: branch 3528 passed, 55 failed, 70 errors, 8 skipped; unmodifiedorigin/mainin the same environment 3498 passed, 55 failed, 70 errors, 8 skipped. All 125 failing/error node IDs match exactly; no new failures. Remaining failures include missing optional integrations (Playwright, AgentScope, CrewAI, LangChain providers, Pydantic AI) and existing integration/API expectation mismatches. Full-suite coverage is 88.92% statements / 81.40% branches; the test suite is not claimed green. The related 362 tests and mypy still pass after dependency installation. Dependency manifests and lockfiles are unchanged.