Skip to content

feat(a2a): add recurring liveness probes for A2A agents - #936

Merged
edenreich merged 5 commits into
mainfrom
fix/issue-932
Jul 18, 2026
Merged

edenreich merged 5 commits into
mainfrom
fix/issue-932

Conversation

@inference-gateway-maintainer

Copy link
Copy Markdown
Contributor

Resolves #932

Summary

Add recurring liveness probes for A2A agents (both external URL-configured and local docker agents), mirroring the MCP manager's probe loop pattern. External agents are now re-probed periodically instead of just once at startup, and local agents get periodic /health checks after they first become ready. Status updates are emitted only on state changes, and probes shut down cleanly with the session.

Changes

  • config/config.go: Add LivenessProbeEnabled and LivenessProbeInterval fields to A2AConfig (defaults: enabled, 30s interval)
  • internal/services/agent_manager.go: Replace one-shot monitorExternalAgents with a ticker-driven periodic probe per external agent; add probeExternalAgent that bypasses the A2A card cache for fresh probes; add startLocalAgentProbe, probeLocalAgent, and handleLocalProbeResult for periodic /health checks on docker agents; add probeCancel/probeWg fields for clean shutdown; update StopAgents to cancel probes and wait before stopping containers
  • Status updates emit only on state transitions (Failed->Ready with "Recovered" message, Ready->Failed) to avoid flooding the UI with redundant events

Add periodic liveness probes for both external (URL-configured) and local (docker) A2A agents, mirroring the MCP manager's probe loop pattern.

- Add LivenessProbeEnabled and LivenessProbeInterval fields to A2AConfig (default: enabled, 30s interval)

- Replace one-shot monitorExternalAgents with a ticker-driven periodic probe per external agent

- Add periodic /health endpoint probing for locally started (docker) agents after they first become ready

- Emit status updates only on state change (Failed->Ready with Recovered message, Ready->Failed)

- Cancel probes cleanly on session shutdown via context cancellation in StopAgents

- Bypass A2A agent card cache during probes by creating a fresh ADK client per probe
Comment thread internal/services/agent_manager.go Resolved
Comment thread internal/services/agent_manager.go Resolved
Comment thread internal/services/agent_manager.go Resolved
Comment thread internal/services/agent_manager.go Resolved
Comment thread internal/services/agent_manager.go Resolved
- Derive AgentReadinessState.ReadyAgents from the per-agent states instead
  of a maintained counter, so the A2A: n/m indicator counts down when an
  agent fails and never exceeds the total after recovery (was showing 2/1)
- Refresh the /a2a agents view on entry so it no longer shows a stale
  snapshot from the last time it was open (e.g. 'pulling' while the status
  bar already showed all agents ready)
- Replace the per-probe cancel funcs (clobbered by each probe start, racy,
  could deadlock StopAgents) with a single probe-stop channel closed once
- Make local health probes context-aware so shutdown aborts in-flight checks
- Seed agent state on local agent startup to avoid a duplicate Ready event
@edenreich
edenreich marked this pull request as ready for review July 18, 2026 21:01
@edenreich
edenreich requested a review from a team as a code owner July 18, 2026 21:01
@edenreich
edenreich merged commit 01ff0d7 into main Jul 18, 2026
1 check passed
@edenreich
edenreich deleted the fix/issue-932 branch July 18, 2026 21:06
@inference-gateway-releaser

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.149.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released Shipped in a release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Add recurring liveness probes for A2A agents (remote and local)

1 participant