Repository navigation
refactor(a2a): extract A2A into its own bounded context - #1371
Conversation
Move the A2A tools, the agent supervisor, the status probe, task tracking, retention and the background task service out of the agent and scheduler contexts into internal/a2a, laid out like internal/mcp: a pure domain/, infrastructure/ for the ADK client adapters, and a root package the container registers through a2a.NewTools. - tools.NewRegistry takes the generic job registry instead of an A2A tracker - scheddomain contracts no longer reference A2A types: retention runs through the generic JobFinisher hook and live A2A rows through RunningJobs - llm_tool_service drops its A2A_ special cases for the SelfGatedTool contract - task states normalize to adk.TaskState constants in one place - depguard confines github.com/inference-gateway/adk to internal/a2a Closes #1368
|
@infer Can you review this PR? is it ready for merge? use /ponytail:ponytail-review /go /go-concurrency /domain-driven-design /clean-code /clean-architecture |
|
Model: Todos
Pull Request✅ Infer Result: SuccessAll review reads are complete. Let me finalize the todo list and deliver the review. Review complete. Here is my full assessment of PR #1371, read against all six invoked lenses. VerdictThis is a well-executed bounded-context extraction. The architecture work is genuinely good and none of my findings are merge blockers - but there is one latent data race, one WaitGroup hazard, and roughly 180 lines of dead flexibility the move carried along, so I would land it after a small cleanup pass. Verdict: comment, not approve-yet. What is good (clean-architecture / DDD)The Dependency Rule holds. Diagnostic-wise this scores about 7/10 on the DDD quick check and 6/7 on the clean-architecture one:
Findings - over-engineering (ponytail-review format)
Net: -180 production lines possible, plus their tests. Findings - concurrency (go-concurrency)
Findings - clean code / Go
Test qualityGood coverage carried over and adapted: tracker tables, job/retention tests rewritten against Model: Tokens: 1,767,684 in · 20,234 out · 1,787,918 total (18 requests) Tool calls: 37 total · 100% success rate TracesStatsTriggered by edenreich · Infer Action · OSS |
|
🎉 This PR is included in version 0.216.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Summary
Extracts A2A out of the
agentandschedulercontexts intointernal/a2a, laid out likeinternal/mcp:internal/a2a/domain: agent cards,AgentSupervisor,AgentState,TaskTracker,TaskPollingState,TaskInfo, retention and background-task contracts, and task-state normalization.internal/a2a/infrastructure: the ADK client adapters (NewClient,AgentCardClient).internal/a2a: theA2A_QueryAgent/A2A_QueryTask/A2A_SubmitTasktools and their manifests (internal/a2a/tools/*.yaml), the task job, tracker, retention, background task service, agent supervisor, status probe and thea2a_agentssystem-prompt section. The container registersa2a.NewTools(...)like the browser and computer tools.internal/agent/applicationis gone, andinternal/agent/toolshas no A2A code.Knots untied
tools.NewRegistrytakes the genericscheddomain.BackgroundTaskRegistryinstead of an A2A tracker, with no type assertions.scheddomainno longer references A2A types.TaskRetainerbecomes the genericJobFinisherhook,A2AStateProvider/A2APollingStatesbecomeSupervisor.RunningJobs(kind), andBackgroundTaskRegistryno longer embeds the A2A tracker. The tracker itself discards in-flight A2A jobs on conversation clear/switch.llm_tool_service.gohas noA2A_special cases. A2A tools implement the newagentdomain.SelfGatedTool, soa2a.enabledalone still switches them on.isTrustedAgentHostbecomesconfig.IsA2AAgentHost, andextractFilenameFromURLbecomesdownload.FilenameFromURL, shared by WebFetch and the artifact download.a2a_agentsprompt section as afunc() string, like the plugin instructions.a2adomaintypes. Task-state labels are sharedTaskStatus*constants, andNormalizeTaskStatereplaces four ad-hoc string comparisons.github.com/inference-gateway/adkis only imported insideinternal/a2a(plus its generated fake).managernaming is nowagentSupervisorthroughout.Behavior notes
tool X is not enabled, replacing "A2A tools are not enabled" / "local tools are not enabled".input-requiredshows "Input Required")..infer/agents/*.mdtool lists.infer exportregisters the A2A tools itself so their results keep their formatting.JobKindA2Astays inscheddomainnext toJobKindRecording.Test plan
task precommit:run(mod tidy, mocks regenerated from the new paths, fmt, lint: 0 issues)go test ./..., including the tool-definitions golden test with the golden file unchangedinfer tools execute A2A_QueryAgentruns witha2a.enabled, rejects missing args, and reports not enabled when A2A is offCloses #1368. Refs #1366.