From d97422d8d7fa584f2923ce84959f100efc2a8286 Mon Sep 17 00:00:00 2001 From: openhands Date: Tue, 26 May 2026 03:22:42 +0000 Subject: [PATCH] Add EVIDENCE_BASED_INFORMATION section to system prompt When providing field values or factual claims, the agent should always support them with official documentation and verifiable sources. This adds an always-on section to the default system prompt that instructs the agent to provide: Field, Value, Quote, and Source for each claim. Fixes OpenHands/extensions#157 Co-authored-by: openhands --- .../openhands/sdk/agent/prompts/system_prompt.j2 | 10 ++++++++++ tests/sdk/agent/test_system_prompt.py | 15 +++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/openhands-sdk/openhands/sdk/agent/prompts/system_prompt.j2 b/openhands-sdk/openhands/sdk/agent/prompts/system_prompt.j2 index 220d19c29a..77ffe035fe 100644 --- a/openhands-sdk/openhands/sdk/agent/prompts/system_prompt.j2 +++ b/openhands-sdk/openhands/sdk/agent/prompts/system_prompt.j2 @@ -131,6 +131,16 @@ You have a browser for navigating pages and interacting with web UIs. - When possible, use more targeted approaches like finding the PID from a pidfile or using application-specific shutdown commands + +When providing field values or factual claims, always support them with official documentation and verifiable sources. For each field, provide: +- **Field**: the field name +- **Value**: the value you are assigning +- **Quote**: the exact text from the source that supports this value +- **Source**: the official link (URL) where the quote can be found + +Prefer primary sources such as official documentation, RFCs, API references, and source code over secondary sources like blog posts or forums. If no official source can be found, state that explicitly rather than fabricating a reference. + + {%- set _imp -%} {%- if model_family -%} {%- include "model_specific/" ~ model_family ~ ".j2" ignore missing -%} diff --git a/tests/sdk/agent/test_system_prompt.py b/tests/sdk/agent/test_system_prompt.py index af7c4490c8..e05b934cb0 100644 --- a/tests/sdk/agent/test_system_prompt.py +++ b/tests/sdk/agent/test_system_prompt.py @@ -84,3 +84,18 @@ def test_system_prompt_none_survives_json_round_trip() -> None: restored = AgentBase.model_validate_json(agent_json) assert isinstance(restored, Agent) assert restored.system_prompt is None + + +# --- evidence-based information section --- + + +def test_default_system_prompt_contains_evidence_based_information() -> None: + """The default system prompt must include the EVIDENCE_BASED_INFORMATION section.""" + agent = Agent(llm=_make_llm(), tools=[]) + msg = agent.static_system_message + assert "" in msg + assert "" in msg + assert "**Field**" in msg + assert "**Value**" in msg + assert "**Quote**" in msg + assert "**Source**" in msg