-
Notifications
You must be signed in to change notification settings - Fork 402
Description
📋 Prerequisites
- I have searched the existing issues to avoid creating a duplicate
- By submitting this issue, you agree to follow our Code of Conduct
- I am using the latest version of the software
- I have tried to clear cache/cookies or used incognito mode (if ui-related)
- I can consistently reproduce this issue
🎯 Affected Service(s)
Controller Service
🚦 Impact/Severity
Blocker
🐛 Bug Description
When a declarative agent references multiple other agents as tools (e.g., 11 agent tools), validation fails with “recursion limit reached in agent tool chain” even though the tool agents only use MCP tools (no further agent tools). The expected nesting depth is 1 (main → tool agent), far below the MAX_DEPTH=10.
🔄 Steps To Reproduce
- Create a agent that calls other agents:
apiVersion: kagent.dev/v1alpha2
kind: Agent
metadata:
name: main-agent
spec:
description: "(...)"
type: Declarative
declarative:
modelConfig: default-model-config
systemMessage: |
(...)
tools:
- type: Agent
agent:
name: sub-agent-1
- type: Agent
agent:
name: sub-agent-2
- type: Agent
agent:
name: sub-agent-3
- type: Agent
agent:
name: sub-agent-4
- type: Agent
agent:
name: sub-agent-5
- type: Agent
agent:
name: sub-agent-6
- type: Agent
agent:
name: sub-agent-7
- type: Agent
agent:
name: sub-agent-8
- type: Agent
agent:
name: sub-agent-9
- type: Agent
agent:
name: sub-agent-10
- type: Agent
agent:
name: sub-agent-11- Then make sure those sub-agents have tools, but only mcpServer tools and not agents:
apiVersion: kagent.dev/v1alpha2
kind: Agent
metadata:
name: sub-agent-X
spec:
description: "(...)"
type: Declarative
declarative:
a2aConfig:
skills:
(...)
modelConfig: default-model-config
systemMessage: |
(...)
tools:
- type: McpServer
mcpServer:
apiGroup: kagent.dev
kind: RemoteMCPServer
name: grafana-mcpserver
toolNames:
- list_prometheus_metric_names
- list_prometheus_metric_metadata
- list_prometheus_label_names
- list_prometheus_label_values- Validate the state of the main agent:
$ kubectl describe agents.kagent.dev main-agent
(...)
Status:
Conditions:
Message: failed to translate agent default/main-agent: recursion limit reached in agent tool chain: default/sub-agent-11 -> default/sub-agent-11
🤔 Expected Behavior
Since Sub agents aren't calling any other agents, I expect that the main agent can still be created without problems.
📱 Actual Behavior
The main agent fails to be accepted by the controller.
💻 Environment
| Component | Version / Details |
|---|---|
| kagent | 0.7.13 |
| Kubernetes | kubeadm v1.34.3 |
| Cloud / Infra | Self-managed k8s cluster |
| LLM provider | Azure OpenAI |
| Model | gpt-5-mini |
| MCP Servers Used | kagent-tools + Grafana MCP Server |
| Grafana MCP Server | 0.9.0 |
| Agent topology | Main Agent → Sub-agent → MCP tools |
🔧 CLI Bug Report
No response
🔍 Additional Context
No response
📋 Logs
{"level":"error","ts":"2026-02-12T08:27:50Z","logger":"reconciler","msg":"failed to reconcile agent","agent":{"name":"main-agent","namespace":"default"},"error":"failed to translate agent default/main-agent: recursion limit reached in agent tool chain: default/sub-agent-11 -> default/sub-agent-11","stacktrace":"github.com/kagent-dev/kagent/go/internal/controller/reconciler.(*kagentReconciler).ReconcileKagentAgent\n\t/workspace/internal/controller/reconciler/reconciler.go:93\ngithub.com/kagent-dev/kagent/go/internal/controller.(*AgentController).Reconcile\n\t/workspace/internal/controller/agent_controller.go:64\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller[...]).Reconcile\n\t/root/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.23.0/pkg/internal/controller/controller.go:222\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller[...]).reconcileHandler\n\t/root/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.23.0/pkg/internal/controller/controller.go:479\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller[...]).processNextWorkItem\n\t/root/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.23.0/pkg/internal/controller/controller.go:438\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller[...]).Start.func1.1\n\t/root/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.23.0/pkg/internal/controller/controller.go:313"}📷 Screenshots
No response
🙋 Are you willing to contribute?
- I am willing to submit a PR to fix this issue
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
Backlog