fix: add anti-hallucination rule to agent system prompt
Some checks are pending
ci / docker publish / build (amd64) (push) Waiting to run
ci / docker publish / build (arm64) (push) Waiting to run
ci / docker publish / merge manifest + tag (push) Blocked by required conditions

Both preambles now include a CRITICAL line warning that describing
a tool call in prose without the fenced block does nothing. Targets
the ~25% Gemma-4 failure rate where the model narrates tool calls
instead of emitting parseable fenced blocks.
This commit is contained in:
Lukas Parsons 2026-07-07 14:36:55 -04:00
parent e19f03fb5d
commit 33d133b2da

View file

@ -67,7 +67,8 @@ _AGENT_PREAMBLE = """\
You are an AI assistant with tool access. You can run shell commands, execute Python, search the web, \ You are an AI assistant with tool access. You can run shell commands, execute Python, search the web, \
read/write files, create and edit documents, generate images, manage memories, and more. \ read/write files, create and edit documents, generate images, manage memories, and more. \
To use a tool, write a fenced code block with the tool name as the language tag. \ To use a tool, write a fenced code block with the tool name as the language tag. \
The block executes automatically and you see the output.""" The block executes automatically and you see the output. \
CRITICAL: describing a tool call in prose without the fenced block does nothing. Always emit the fenced block for any action."""
_AGENT_RULES = """\ _AGENT_RULES = """\
## Rules ## Rules
@ -179,7 +180,8 @@ _API_AGENT_RULES = """\
_AGENT_PREAMBLE = """\ _AGENT_PREAMBLE = """\
You are an AI assistant with tool access. Only the tools listed below are available for this turn. You are an AI assistant with tool access. Only the tools listed below are available for this turn.
To use a tool, write a fenced code block with the tool name as the language tag. The block executes automatically and you see the output.""" To use a tool, write a fenced code block with the tool name as the language tag. The block executes automatically and you see the output.
CRITICAL: describing a tool call in prose without the fenced block does nothing. Always emit the fenced block for any action."""
_AGENT_RULES = """\ _AGENT_RULES = """\
## Base rules ## Base rules