Skip to content

Agent to Agent tool reference created before the referenced Agent exists is never retried #2599

Description

@EdmondDantes21

Prerequisites

  • I have searched the existing issues to avoid creating a duplicate
  • By submitting this issue, you agree to follow the Code of Conduct
  • I am using the latest version of the software.t
  • I can consistently reproduce this issue

Affected Service(s)

Controller Service

Impact/Severity

Blocker: a fresh multi-agent install (Helm/GitOps/Argo/any tool that doesn't strictly order same-kind CRDs) can silently and permanently leave an agent broken with no indication anything will ever fix it.

Bug Description

When an Agent/SandboxAgent CR references another Agent that doesn't exist yet at apply time, the referencing agent gets stuck at Accepted: False forever, even after the referenced agent is created. The controller never retries.

The only things that ever re-trigger reconciliation of the broken parent are editing its spec, changing its labels, or restarting the kagent-controller pod.

Steps To Reproduce

  1. Create the parent agent, referencing a child that does not exist yet:

    apiVersion: kagent.dev/v1alpha2
    kind: Agent
    metadata:
      name: repro-parent-agent
      namespace: default
    spec:
      type: Declarative
      declarative:
        modelConfig: repro-placeholder-model-config
        runtime: python
        systemMessage: "test agent, never meant to run"
        tools:
        - type: Agent
          agent:
            kind: Agent
            name: repro-child-agent
    $ kubectl apply -f repro-parent.yaml
    agent.kagent.dev/repro-parent-agent created
    
  2. Check its status (~5s later):

    $ kubectl get agent repro-parent-agent -n default -o jsonpath='{.status.conditions}'
    [{"lastTransitionTime":"2026-08-27T13:34:16Z",
      "message":"failed to compile agent default/repro-parent-agent: Agent.kagent.dev \"repro-child-agent\" not found",
      "observedGeneration":1,"reason":"ReconcileFailed","status":"False","type":"Accepted"}]
    
  3. Create the referenced child agent:

    apiVersion: kagent.dev/v1alpha2
    kind: Agent
    metadata:
      name: repro-child-agent
      namespace: default
    spec:
      type: Declarative
      declarative:
        modelConfig: repro-placeholder-model-config
        runtime: python
        systemMessage: "test agent, never meant to run"
        tools: []
    $ kubectl apply -f repro-child.yaml
    agent.kagent.dev/repro-child-agent created
    

    (repro-child-agent now exists and is kubectl get-able immediately.)

  4. Re-check the parent's status 60s, then ~3 more minutes later — untouched:

    $ kubectl get agent repro-parent-agent -n default -o jsonpath='{.status.conditions[0]}'
    {"lastTransitionTime":"2026-08-27T13:34:16Z",
     "message":"failed to compile agent default/repro-parent-agent: Agent.kagent.dev \"repro-child-agent\" not found",
     "observedGeneration":1,"reason":"ReconcileFailed","status":"False","type":"Accepted"}
    

    Identical lastTransitionTime and observedGeneration — never re-reconciled.

Expected Behavior

Creating repro-child-agent should, on its own, cause repro-parent-agent to be re-reconciled and re-evaluate the tool reference — the same way creating a ModelConfig, RemoteMCPServer, ConfigMap, or MCPServer that an agent depends on already does.

Actual Behavior

repro-parent-agent stays pinned at Accepted: False / ReconcileFailed with a stale "not found" message indefinitely, even though the resource it complains about has existed for minutes. Only an incidental spec/label change or a full controller pod restart unsticks it.

Environment

  • Kubernetes: kind, v1.36.1
  • kagent: v0.9.12
  • Install method: helm

Are you willing to contribute?

  • I am willing to submit a PR to fix this issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions