Skip to content

fix: show tool names in history and return the model answer - #695

Open
anxkhn wants to merge 1 commit into
a2aproject:mainfrom
anxkhn:fix/no-llm-framework-tool-history
Open

anxkhn wants to merge 1 commit into
a2aproject:mainfrom
anxkhn:fix/no-llm-framework-tool-history

Conversation

@anxkhn

@anxkhn anxkhn commented Aug 20, 2026

Copy link
Copy Markdown

Fixes #438.

Agent.stream stored each MCP call as {'tool': name, ...}, but called_tools_history.jinja reads tool.name. The next decide prompt showed a blank tool name, so the agent could not see what it already called.

When no further tools were needed, the complete event also replaced the last model response with Task completed. Clients that read the final artifact got the placeholder instead of the <Answer> body.

This change stores the history record under name (and includes isError in the template), keeps the last model response as the complete content, and stops emitting Step N / raw history strings as artifact text. Tests render the real Jinja template and check the complete event.

Tested with:

uv run --with pytest --directory samples/python/agents/a2a-mcp-without-framework pytest tests/test_tool_history.py -q

@anxkhn
anxkhn force-pushed the fix/no-llm-framework-tool-history branch 2 times, most recently from 0f2fc95 to 33a6f14 Compare August 25, 2026 18:04
Signed-off-by: Anas Khan <83116240+anxkhn@users.noreply.github.com>
@anxkhn
anxkhn force-pushed the fix/no-llm-framework-tool-history branch from 33a6f14 to be5b333 Compare August 25, 2026 18:05
@soyeladice-svg

Copy link
Copy Markdown

Burs-IA technical review (operator-assisted; public-source only):

I reproduced one boundary condition in the current PR logic: at the ten-call limit, the loop can reach its success path while the model response still contains a tool/function request rather than a terminal answer.

A focused regression would be useful here: make the 10th model response request another tool and assert that the run does not report success/terminal completion while an unresolved tool request remains.

This is a bounded review finding, not a conformance claim. No private endpoints or credentials were used.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug in pure mcp example (missing tool name)

2 participants