Repository navigation
refactor(rust): let the adk resolve the agent card url - #461
Conversation
| // mirrored here. | ||
| var GoBuiltins = map[string]string{ | ||
| "github.com/inference-gateway/adk": "v0.32.1", | ||
| "github.com/inference-gateway/adk": "v0.31.1", |
There was a problem hiding this comment.
@claude This was on purpose, we use the latest version of the adk, make sure it works.
"github.com/inference-gateway/adk": "v0.32.1",
There was a problem hiding this comment.
Claude finished @edenreich's task in 2m 18s —— View job
Go ADK pin restored to v0.32.1
You were right - the branch commit had quietly downgraded github.com/inference-gateway/adk from v0.32.1 to v0.31.1 in internal/vendor/vendor.go:108. That was unintended collateral; this PR is a Rust-only refactor and should not have touched the Go pin. Restored in 6a1aad5.
- Confirm the regression in the diff
- Restore
v0.32.1(also the latest release ofinference-gateway/adk) - Verify it works
- Commit
Verification
go build ./...,go vet ./...,go test ./...- all green.- Generated
examples/go-agent-ai.yamlinto a scratch dir:go.modnow pinsgithub.com/inference-gateway/adk v0.32.1,go mod tidyresolves it, andgo build ./...on the generated project succeeds. - Generated
main.gokeeps the existing resolution line unchanged under v0.32.1:cfg.A2A.AgentURL = cmp.Or(cfg.A2A.AgentURL, "", "http://localhost:"+cfg.A2A.ServerConfig.Port+"/a2a").
The Rust pin stays at inference-gateway-adk 0.16.2 (also the latest), which is what the refactor actually depends on - that line is already on main from #460, so vendor.go in this PR is now a no-op diff against origin/main.
But the examples works as expected? or we have here a bug? |
|
Claude finished @edenreich's task in 1m 29s —— View job No bug - the Go examples serve the right URL
The Go template resolves the URL and then injects it into the card itself, so the served card is correct - it just does the work in generated code instead of delegating to the ADK. Generated // line 182
cfg.A2A.AgentURL = cmp.Or(cfg.A2A.AgentURL, "", "http://localhost:"+cfg.A2A.ServerConfig.Port+"/a2a")
...
// line 247, inside WithAgentCardFromFile overrides
{"url": cfg.A2A.AgentURL, "protocolBinding": "JSONRPC", "protocolVersion": "1.0"},The card file on disk has Why the Go block can't be droppedChecked
So this is the Go ADK's design (caller supplies the advertised URL), not a defect. rust-adk The one thing worth filing (not a bug in this PR)Both languages ship a card file with Tests green: |
## [0.65.4](v0.65.3...v0.65.4) (2026-10-03) ### ♻️ Improvements * **rust:** let the adk resolve the agent card url ([#461](#461)) ([f5e438a](f5e438a)) ### 🐛 Bug Fixes * serve and advertise the a2a json-rpc endpoint at /a2a in every language ([#457](#457)) ([71e2c82](71e2c82)) * **typescript:** register every a2a method the agent card advertises ([#458](#458)) ([7149295](7149295)) ### 🔧 Miscellaneous * **deps:** bump template pins to latest ([#460](#460)) ([503a054](503a054))
|
🎉 This PR is included in version 0.65.4 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Summary
Still relevant - rust-adk
0.16.2(released today) contains the fix from inference-gateway/rust-adk#195, so the generatedmain.rsno longer has to resolve the advertised card URL itself.inference-gateway-adkpin ininternal/vendor/vendor.gofrom0.16.1to0.16.2.agent_urlresolution block and theAgentCardOverridesimport frominternal/templates/languages/rust/main.rs.tmpl; the builder now calls.with_agent_card_from_file(".well-known/agent-card.json", None)and the ADK applies the precedenceA2A_AGENT_URL> the card file's own non-empty interface URL >http(s)://localhost:<A2A_SERVER_PORT>/a2a.config/agent.jsonalready writesspec.card.supportedInterfaces[0].urlinto the generated card file, which is exactly the branch the ADK reads.A2A_AGENT_URLstill lands inconfig.agent_urlthrough the existingenvy::prefixed("A2A_")load, so the env override is unchanged.TestMainTemplates_DefaultCardURLToJSONRPCEndpointto assert the generated main delegates to the ADK (card file passed withNone, noA2A_AGENT_URLhandling left inmain.rs). The three URL sources stay covered: env and derived-default precedence is pinned by rust-adk's ownadvertised_agent_url_precedencetest, and the manifest-declared / empty-interface card output stays pinned byTestAgentCardTemplate_EmitsV101ShapeandTestAgentCardTemplate_DefaultsSupportedInterfaces.Go ADK: no change
Checked
inference-gateway/adkatv0.32.1- nothing populates the card's interface URL fromcfg.AgentURL, so the Go template'scmp.Orblock inmain.go.tmplhas to stay. Its test cases are untouched.Behaviour note
One edge changes for Rust: a manifest with
spec.server.scheme: https, nospec.card.supportedInterfaces[].urland noA2A_AGENT_URLpreviously advertisedhttps://localhost:<port>/a2a; the ADK derives the scheme fromA2A_TLS_ENABLEinstead, so it now advertiseshttp://...unless TLS is on - which is the more accurate advertisement for a server not actually serving TLS. No example hits this (every Rust example usesscheme: http), and settingA2A_AGENT_URLor a manifest interface URL pins it either way.Verified with
go build ./...,go vet ./...,go test ./...and by generatingexamples/rust-agent-ai.yaml.no docs ticket: internal-only refactor - the documented
A2A_AGENT_URLbehaviour and its default are unchanged.Closes #459