Skip to content

[BUG] Agent Framework: When model responds only with a toolUse block without any text agent execution fails. #3751

Closed
@pyek-bot

Description

@pyek-bot

What is the bug?
Agent framework internally uses Function Calling for a few supported models:

  • Bedrock Claude
  • DeepSeek
  • OpenAI

These models support function calling. However, when the model responds with only a toolUse payload without any text then the agent execution fails.
Example error:
com.jayway.jsonpath.PathNotFoundException: No results for path: $['output']['message']['content'][0]['text']

This happens because the AgentUtils::ParseLLMOutput method first searches for the "llm_response_filter" field before looking for a tool call path.

Example payload for failure:

{"metrics":{"latencyMs":2875},"output":{"message":{"content":[{"toolUse":{"input":{"index":"ss4o_logs-2025.04.18","query":{"size":10,"_source":["body","time","severityText","log.attributes","resource.attributes.service.name"],"query":{"bool":{"must":[{"wildcard":{"body":"*cart*"}},{"term":{"severityText":"ERROR"}}]}}}},"name":"SearchIndexTool","toolUseId":"tooluse_c33B609fSbCsgDeTTj8VmA"}}],"role":"assistant"}},"stopReason":"tool_use","usage":{"cacheReadInputTokenCount":0,"cacheReadInputTokens":0,"cacheWriteInputTokenCount":0,"cacheWriteInputTokens":0,"inputTokens":9000,"outputTokens":152,"totalTokens":9152}}

How can one reproduce the bug?
Intermittent issue depends on model response.

What is the expected behavior?
Parsing the model output should handle cases where text is not provided with a toolUse block.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions