Skip to content

fix: add ALWAYS REQUIRED markers to communication prompt to prevent missing tool_name#1461

Open
gdeyoung wants to merge 1 commit intoagent0ai:mainfrom
gdeyoung:fix/prompt-quality-steering-v17
Open

fix: add ALWAYS REQUIRED markers to communication prompt to prevent missing tool_name#1461
gdeyoung wants to merge 1 commit intoagent0ai:mainfrom
gdeyoung:fix/prompt-quality-steering-v17

Conversation

@gdeyoung
Copy link
Copy Markdown
Contributor

@gdeyoung gdeyoung commented Apr 6, 2026

TL;DR — Models like GLM-5.1 and MiniMax frequently output JSON without the required tool_name field, causing agent crashes

The agent.system.main.communication.md prompt tells the LLM how to format responses, but the tool_name and tool_args requirements are easy to miss in the field list. Adding explicit ← ALWAYS REQUIRED markers and a bold CRITICAL warning line reduces missing-field errors by making the requirement unmissable.

Zero code changes — pure prompt engineering that prevents ~10 crashes per day with non-OpenAI models.


Problem

Current prompt format:

- tool_name: use tool name
- tool_args: key value pairs tool arguments

These look like every other field in the list. Models that produce JSON sometimes skip them, resulting in:

{"thoughts": [...], "headline": "..."}

Missing tool_name → agent can't identify the tool → crash → misformat warning → wasted turn.

Solution

Add explicit markers that are impossible to miss:

- tool_name: use tool name  ← ALWAYS REQUIRED
- tool_args: key value pairs tool arguments  ← ALWAYS REQUIRED

- **CRITICAL: Every response MUST contain both "tool_name" and "tool_args" fields. Never output JSON without them.**

Impact

  • Before: ~10 missing tool_name errors per day with GLM-5.1
  • After: ~0-1 per day
  • No code changes — purely improves prompt clarity
  • Works with any LLM — no model-specific code

Changes

File Change
prompts/agent.system.main.communication.md Add ALWAYS REQUIRED markers + CRITICAL warning line

Testing

  • 2 regression tests verify the markers are present in the prompt
  • Running in production for 3+ days with significant error reduction

Related

…output

Models like GLM-5.1 and MiniMax occasionally output JSON without the
required tool_name field. Adding explicit ALWAYS REQUIRED markers and
a CRITICAL warning line to the communication prompt reduces these
errors significantly by making the requirement impossible to miss.
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.

1 participant