Skip to content

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

Closed
inference-gateway/docs
#425

Description

@edenreich

Summary

Remote A2A agents (URLs configured under a2a.agents, no docker involved) are only checked once at startup: monitorExternalAgents in internal/services/agent_manager.go sleeps 2 seconds, performs a single GetAgentCard fetch with a 5 second timeout per agent, and marks the agent Ready or Failed. That status is then frozen for the lifetime of the session:

  • If the remote agent is down (or slow) at startup, it is marked red (Agent not reachable) and never re-probed - it will not turn green when the agent comes back, even though the agent may be perfectly usable minutes later. The only recovery is restarting the chat session.
  • Conversely, if a remote agent goes down mid-session, the indicator keeps showing green and the user only finds out when a delegated task fails.

Local (docker) agents have the same gap after startup: waitForReady polls /health only until the agent first becomes ready, after which its state is never revisited.

This is inconsistent with the MCP manager, which already runs recurring liveness probes (internal/services/mcp_manager.go) and re-registers tools when a server comes back. Agents should get the same treatment: a periodic background probe that keeps AgentReadinessState truthful and pushes updates through the existing notifyStatus -> AgentStatusUpdateEvent pipeline, so the A2A: n/m indicator color and the /a2a agents view (which is live-updating since #542) always reflect reality.

Suggested shape (mirroring the MCP manager's probe loop):

  • A ticker-driven probe per agent (e.g. every 30s, configurable) that re-runs GetAgentCard for external agents and GET <url>/health for locally started containers.
  • State transitions on change only: Failed -> Ready when a probe succeeds (with a Recovered style message), Ready -> Failed when it stops responding; no event spam while the state is stable.
  • Probes stop cleanly on session shutdown via the existing context cancellation.

Follow-up from #542, where the one-shot behavior was observed while making the readiness indicator and agents view live.

Acceptance Criteria

  • External agents (a2a.agents URLs) are re-probed periodically for the lifetime of the session, not just once 2 seconds after startup
  • Locally started (docker) agents are also re-probed via their /health endpoint after they first become ready
  • An agent that was Failed at startup transitions to Ready automatically once it becomes reachable, and the A2A: n/m indicator and /a2a view update accordingly (green when all recover)
  • An agent that becomes unreachable mid-session transitions to Failed, turning the indicator red and showing the failure detail in the /a2a view
  • Status updates are emitted only on state changes so the UI is not flooded with redundant AgentStatusUpdateEvents
  • The probe interval is configurable with a sensible default, and probes shut down cleanly with the session

Activity

  1. added
    enhancement
    on Jul 18, 2026
  2. moved this to Todo in 2026on Jul 18, 2026
  3. edenreich commented on Jul 18, 2026

    @edenreich
    ContributorAuthor

    @infer Can you work on this? use /go /go-concurrency /ponytail:ponytail

  4. inference-gateway-maintainer commented on Jul 18, 2026

    @inference-gateway-maintainer
    Contributor

    Model: ollama_cloud/deepseek-v4-flash · View Job

    Todos

    • Read existing code: agent_manager.go, mcp_manager.go, domain interfaces, and related files
    • Add issue to project board and set status to In progress
    • Add LivenessProbeEnabled/Interval to A2AConfig in config/config.go
    • Add probe fields and periodic probe loop to AgentManager
    • Wire periodic probes for external agents (a2a.agents URLs)
    • Wire periodic health probes for local (docker) agents after first readiness
    • Ensure clean shutdown via context cancellation in StopAgents
    • Commit, push, create draft PR, and update project board

    Pull Request

    #936

    ✅ Infer Result: Success

    All acceptance criteria from the issue are met. The implementation is complete - no further work needed.

    Model: ollama_cloud/deepseek-v4-flash · Exit Code: 0 · Duration: 10m 36s

    Tokens: 10,011,081 in · 19,094 out · 10,030,175 total (50 requests)

    Tool calls: 62 total · 94% success rate

    Traces
    Session: 1784405652-3cdfd63d
    
    session (standard, success)               10m34s
    ├── chat ollama_cloud/deepseek-v4-flash     2.9s
    ├── execute_tool TodoWrite                 345µs
    ├── chat ollama_cloud/deepseek-v4-flash     2.2s
    ├── execute_tool Read                      631µs
    ├── execute_tool Read                      424µs
    ├── execute_tool Read                      439µs
    ├── chat ollama_cloud/deepseek-v4-flash     3.6s
    ├── execute_tool Read                      760µs
    ├── execute_tool Read                      342µs
    ├── execute_tool Read                      156µs
    ├── chat ollama_cloud/deepseek-v4-flash     3.9s
    ├── execute_tool Grep                       91ms
    ├── execute_tool Read                      130µs [error: tool_error]
    ├── execute_tool Grep                       89ms
    ├── chat ollama_cloud/deepseek-v4-flash     3.9s
    ├── execute_tool Read                      575µs
    ├── execute_tool Grep                       76ms
    ├── execute_tool Read                        1ms
    ├── chat ollama_cloud/deepseek-v4-flash     4.0s
    ├── execute_tool Grep                       22ms
    ├── execute_tool Read                      180µs
    ├── chat ollama_cloud/deepseek-v4-flash     4.0s
    ├── execute_tool Read                      220µs
    ├── execute_tool Read                      128µs
    ├── chat ollama_cloud/deepseek-v4-flash     4.2s
    ├── execute_tool Grep                      590µs
    ├── execute_tool Grep                        5ms
    ├── chat ollama_cloud/deepseek-v4-flash     4.3s
    ├── execute_tool Read                      211µs
    ├── execute_tool Read                      193µs
    ├── execute_tool Read                      157µs
    ├── chat ollama_cloud/deepseek-v4-flash    18.0s
    ├── execute_tool TodoWrite                  65µs
    ├── chat ollama_cloud/deepseek-v4-flash     4.6s
    ├── execute_tool Bash                        8ms
    ├── chat ollama_cloud/deepseek-v4-flash     4.5s
    ├── execute_tool Bash                       1.1s
    ├── chat ollama_cloud/deepseek-v4-flash     4.0s
    ├── execute_tool Bash                      313ms
    ├── chat ollama_cloud/deepseek-v4-flash     5.8s
    ├── execute_tool Bash                       1.3s
    ├── chat ollama_cloud/deepseek-v4-flash     4.6s
    ├── execute_tool Bash                      23.9s
    ├── chat ollama_cloud/deepseek-v4-flash     4.1s
    ├── execute_tool Bash                      493ms
    ├── chat ollama_cloud/deepseek-v4-flash     5.4s
    ├── execute_tool TodoWrite                  89µs
    ├── chat ollama_cloud/deepseek-v4-flash     3.6s
    ├── execute_tool Edit                        1ms
    ├── chat ollama_cloud/deepseek-v4-flash     7.8s
    ├── execute_tool Edit                        1ms
    ├── chat ollama_cloud/deepseek-v4-flash     7.6s
    ├── execute_tool TodoWrite                  69µs
    ├── chat ollama_cloud/deepseek-v4-flash    13.0s
    ├── chat ollama_cloud/deepseek-v4-flash     8.4s
    ├── execute_tool Edit                      533µs
    ├── chat ollama_cloud/deepseek-v4-flash    13.1s
    ├── execute_tool Edit                        1ms
    ├── chat ollama_cloud/deepseek-v4-flash    10.9s
    ├── execute_tool Edit                      527µs
    ├── chat ollama_cloud/deepseek-v4-flash    11.2s
    ├── execute_tool Edit                      597µs
    ├── chat ollama_cloud/deepseek-v4-flash    13.0s
    ├── execute_tool Edit                      554µs
    ├── chat ollama_cloud/deepseek-v4-flash    11.8s
    ├── execute_tool Edit                      693µs
    ├── chat ollama_cloud/deepseek-v4-flash    10.9s
    ├── execute_tool Bash                      57.0s [error: tool_error]
    ├── chat ollama_cloud/deepseek-v4-flash     9.2s
    ├── execute_tool Read                      134µs
    ├── chat ollama_cloud/deepseek-v4-flash    14.8s
    ├── execute_tool Edit                      775µs
    ├── chat ollama_cloud/deepseek-v4-flash    11.2s
    ├── execute_tool Bash                       6.6s
    ├── chat ollama_cloud/deepseek-v4-flash     9.5s
    ├── execute_tool Bash                      22.9s [error: tool_error]
    ├── chat ollama_cloud/deepseek-v4-flash    11.6s
    ├── execute_tool Edit                      674µs
    ├── chat ollama_cloud/deepseek-v4-flash    16.5s
    ├── execute_tool Edit                      651µs
    ├── chat ollama_cloud/deepseek-v4-flash    14.2s
    ├── execute_tool Edit                      680µs
    ├── chat ollama_cloud/deepseek-v4-flash    11.4s
    ├── execute_tool Bash                      13.0s [error: tool_error]
    ├── chat ollama_cloud/deepseek-v4-flash    12.1s
    ├── execute_tool Edit                      517µs
    ├── chat ollama_cloud/deepseek-v4-flash    12.5s
    ├── execute_tool Edit                      403µs
    ├── chat ollama_cloud/deepseek-v4-flash    12.0s
    ├── execute_tool Bash                      14.4s
    ├── chat ollama_cloud/deepseek-v4-flash    13.0s
    ├── execute_tool TodoWrite                  72µs
    ├── chat ollama_cloud/deepseek-v4-flash    14.7s
    ├── execute_tool Bash                       10ms
    ├── chat ollama_cloud/deepseek-v4-flash    13.0s
    ├── execute_tool Bash                       3.2s
    ├── chat ollama_cloud/deepseek-v4-flash    13.4s
    ├── execute_tool Bash                       1.0s
    ├── chat ollama_cloud/deepseek-v4-flash    15.0s
    ├── execute_tool Write                     758µs
    ├── chat ollama_cloud/deepseek-v4-flash    11.9s
    ├── execute_tool Bash                       1.6s
    ├── chat ollama_cloud/deepseek-v4-flash    15.1s
    ├── execute_tool Bash                      638ms
    ├── chat ollama_cloud/deepseek-v4-flash    13.3s
    ├── execute_tool Bash                      634ms
    ├── execute_tool Bash                        9ms
    ├── chat ollama_cloud/deepseek-v4-flash    15.1s
    ├── execute_tool TodoWrite                  78µs
    ├── chat ollama_cloud/deepseek-v4-flash    15.0s
    ╰── chat ollama_cloud/deepseek-v4-flash    14.8s
    
    Stats
    Tool Calls
    
    ╭───────────┬───────┬───────┬────────╮
    │ Tool      │ Calls │ Fail% │ Avg    │
    ├───────────┼───────┼───────┼────────┤
    │ Bash      │ 18    │ 17%   │ 8231ms │
    │ Read      │ 16    │ 6%    │ 0ms    │
    │ Edit      │ 14    │ 0%    │ 0ms    │
    │ TodoWrite │ 6     │ 0%    │ 0ms    │
    │ Grep      │ 6     │ 0%    │ 47ms   │
    │ Write     │ 1     │ 0%    │ 0ms    │
    ╰───────────┴───────┴───────┴────────╯
    
    Token Usage
    
    ╭────────────────────────────────┬──────────┬────────────┬──────────┬──────╮
    │ Model                          │ Prompt   │ Completion │ Total    │ Cost │
    ├────────────────────────────────┼──────────┼────────────┼──────────┼──────┤
    │ ollama_cloud/deepseek-v4-flash │ 10011081 │ 19094      │ 10030175 │ -    │
    ╰────────────────────────────────┴──────────┴────────────┴──────────┴──────╯
    
    Sessions
    
    ╭───────────┬──────────┬──────────╮
    │ Execution │ Mode     │ Sessions │
    ├───────────┼──────────┼──────────┤
    │ headless  │ standard │ 1        │
    ╰───────────┴──────────┴──────────╯
    
    ⚠️ 4 log(s)
    • Read:
      NOT_FOUND: /home/runner/work/cli/cli/internal/services/a2a_agent_service.go
      
    • Bash:
      exit status 1: # github.com/inference-gateway/cli/internal/services
      internal/services/agent_manager.go:56:3: unknown field agentStates in struct literal of type AgentManager
      … (truncated)
      
    • Bash:
      exit status 201: �[32mtask: [precommit:run] ./.githooks/pre-commit
      �[0mpre-commit: using task from PATH (/opt/hostedtoolcache/task/3.48.0/x64/bin/task)
      … (truncated)
      
    • Bash:
      exit status 201: �[32mtask: [precommit:run] ./.githooks/pre-commit
      �[0mpre-commit: using task from PATH (/opt/hostedtoolcache/task/3.48.0/x64/bin/task)
      … (truncated)
      

    Triggered by edenreich · Infer Action

  5. moved this from Todo to In progress in 2026on Jul 18, 2026
  6. moved this from In progress to QA in 2026on Jul 18, 2026
  7. added a commit that references this issue on Jul 18, 2026
    01ff0d7
  8. moved this from QA to Done in 2026on Jul 18, 2026
  9. inference-gateway-releaser commented on Jul 18, 2026

    @inference-gateway-releaser
    Contributor

    🎉 This issue has been resolved 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementreleased

    Projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions