Subagent toolcalls not handled when using LiteLLM proxy Summary When using cagent with a…
- User
Subagent tool_calls not handled when using LiteLLM proxy
Summary
When using cagent with a LiteLLM proxy (OpenAI-compatible API), a subagent can return a valid
tool_callsresponse, but the host agent reports “no response from subagent” and does not execute the tool call.Environment
- cagent: v1.19.7
- OS: Linux (WSL2) x86_64
- LLM: gemini-pro via LiteLLM proxy (OpenAI-compatible)
Expected
Host agent receives the subagent response and executes the tool call(s), then continues the conversation with the tool result.
Actual
Host agent reports there is “no response from subagent” even though the subagent response contains a valid
tool_callsentry. The requested tool call is not executed.Minimal reproduction
- Configure cagent to use LiteLLM as the model provider (OpenAI-compatible API).
- Run a workflow where the subagent is asked to use tools.
- The subagent returns a tool call (e.g.,
company_searchwith JSON arguments) and finishes withfinish_reason: "stop". - The host agent logs “no response from subagent” and does not invoke the tool.
Notes
- The subagent response includes a valid tool call object (
type: function,name: company_search,arguments: {"datasources": ["confluence", "github", "gdrive"], "query": "LiteLLM usage teams integrations standards"}). - I can reproduce consistently with LiteLLM as the proxy in front of an OpenAI-compatible endpoint.
Please let me know if you want a sanitized example payload or a minimal agent config.
Interface
No new interfaces are introduced.
- Assistant
I’ll trace the OpenAI-compatible response conversion and subagent execution path, then add a focused regression test before running the project checks.
- Assistant
rgisn’t installed in this checkout, so I’m switching togit grep/findand continuing the trace. - Assistant
The failure is in stream aggregation: it returns immediately on
finish_reason: "stop"before reading tool calls carried in that same LiteLLM chunk. Standard OpenAI streams usually split these across chunks, which hid the ordering bug. I’m adding the same-chunk regression case and moving terminal handling after delta aggregation. - Assistant
The regression test now models LiteLLM’s single terminal chunk (
tool_callsplusfinish_reason: stop). The runtime captures the call and rewrites the effective finish reason totool_calls; I’m running the focused tests now. - Assistant
The focused regression tests pass with constrained Go parallelism (the first attempt exhausted the container’s process limit during compilation). I’m now running the required full test, build, and lint checks with the same safe concurrency cap.
- Assistant
The repository’s
taskrunner is not installed in this environment. I’ll inspect the Taskfile and invoke the underlying build/test/lint commands directly so validation remains equivalent. - Assistant
The full suite is still compiling the repository’s dependency graph and has not reported failures. The concurrency cap is preventing the earlier process exhaustion; I’m letting it complete before build/lint.
- Assistant
The full compile caught a test-only constant mismatch (
ToolTypeFunctionis not defined in this project); the implementation itself compiled. I’m correcting the fixture to use the project’s existing typed string pattern, then rerunning the focused package and remaining checks. The suite also exposed unrelated environment/root-permission failures, which I’ll separate from this change. - Assistant
The fix is complete and the targeted runtime tests, build, custom repository lint,
go vet, formatting, and module-tidy check pass. Full-suite failures are unrelated environment/baseline issues: missingjq, tests that assume non-root filesystem permissions, and stale example model catalog entries;golangci-lintitself is also not installed here.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.