ISSUE DESCRIPTION Subagent toolcalls not handled when using LiteLLM proxy Summary When…
- User
ISSUE DESCRIPTION
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.
ADDITIONAL ADVICE
Since you are given a git repository, you can use git commands to simplify your work. For example, if you made a mistake and want to revert your changes, you can use
git checkout <file>to restore the file to its original state. You can also reset all changes in the repository usinggit reset --hardcommand. Additionally, you can usegit stashandgit stash popto temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you callsubmit) usinggit statusorgit diffcommands. However you don't need to usegit addorgit commitbefore submitting your changes. In fact,submitonly submits currently unstaged changes because it usesgit diffto get the changes that need to be submitted.CHECKLIST
Before submitting your solution, please go over the following checklist and make sure you've done everything:
- If an error was reported in the issue description, I have successfully reproduced it.
- If an error was reported in the issue description, I have confirmed that my fix resolves the error.
- I have thought about edge cases and made sure my fix handles them as well.
- I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. I want you to list every bullet from this checklist and write your reasoning for why you think you did it or didn't need to.
Repository has been uploaded and your shell is currently at the repository root. Time to solve the issue!
(Current directory: /docker-agent, current file: none) bash-$
- Assistant
I'll start by exploring the repository structure and searching for code related to subagent tool_calls handling.
- Assistant
Searching for the "no response from subagent" message and related tool_calls handling.
- Assistant
rg is not available, let me use grep instead.
- Assistant
Hmm no matches. Let me try different search terms related to tool_calls and subagents.
- Assistant
Looking at agent delegation and how subagent responses are processed.
- Assistant
Let me look at agent_delegation.go more carefully and the GetLastAssistantMessageContent function - the issue says "no response from subagent".
- Assistant
The "No response from agent" message appears in a few places — reading those and the streaming finish-reason handling next.
- Assistant
The problem could be in how the OpenAI-compatible provider parses LiteLLM stream responses — I'll inspect that path next.
- Assistant
Let me look at the CHANGELOG for recent related fixes and also search for LiteLLM related issues.
- Assistant
Suspecting finish_reason and tool_calls arrive in the same chunk and get skipped — checking OpenAI stream parsing next.
- Assistant
Let me look at the oaistream package which handles stream conversion.
- Assistant
There's something interesting in adapter.go around lines 142-156 - when finishReason is stop. Let me read the full adapter.go file.
- Assistant
Let me see the rest of the file, especially around tool calls and the finish reason stop handling.
- Assistant
Checking git history and tests for similar finish_reason/tool_calls bugs:
- Assistant
The issue mentions argumments may be JSON objects rather than strings—checking how those are unmarshaled.
- Assistant
Where is "no response from subagent" literally? The issue says that phrase. Let me search more broadly.
- Assistant
The issue says "no response from subagent" - might be paraphrased from "No response from agent". Or it might come from the agent tool itself.
- Assistant
Let me look at transfer_task which is the synchronous single tool path, and also GetLastAssistantMessageContent.
- Assistant
I'll look at existing streaming tests to reproduce the same-chunk finish_reason + tool_calls bug.
- Assistant
Let me look at the streamBuilder and how tool calls with finish reason are handled, and also check git blame or issues related to this.
- Assistant
Writing a quick reproduction test for the same-chunk finish_reason + tool_calls bug.
- Assistant
Need to set up Go environment.
- Assistant
Need to find the correct sink and telemetry types.
- Assistant
Let me find Telemetry interface and noop implementation.
- Assistant
I'll update the test to use defaultTelemetry{} and EventSinkFunc.
- Assistant
Confirmed. I'll also check whether non-delta message.tool_calls need handling.
- Assistant
Refactoring
handleStreamso deltas are applied before handling finish_reason. - Assistant
Rewriting the stream loop so delta content (including tool calls) is processed before finish_reason handling.
- Assistant
Running the reproduction tests to verify the fix:
- Assistant
Removing the temporary test file and running broader runtime tests.
- Assistant
Some tests failed—checking which ones.
- Assistant
Only one test failed - let me see the full failure.
- Assistant
This failure might be unrelated to my changes - checking whether it fails on the original code too.
- Assistant
Verifying the partial tool-call + finish_reason edge case:
- Assistant
Reviewing the final diff and file structure:
- Assistant
Confirming the file is formatted and does a final tool-call test pass:
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Identical first prompt
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.5-35B-A3BCompare side by side →
Qwen/Qwen3.5-35B-A3BCompare side by side →