From dbfe0a3acaaa927e6c230d0cbb11f4db04eba7b8 Mon Sep 17 00:00:00 2001 From: Anish Sarkar <104695310+AnishSarkar22@users.noreply.github.com> Date: Mon, 17 Aug 2026 14:27:37 +0530 Subject: [PATCH] refactor(prompts): clarify artifact format handling and response structure in routing and task descriptions --- .../main_agent/system_prompt/prompts/routing.md | 10 ++++++---- .../system_prompt/prompts/tools/task/description.md | 4 ++-- .../subagents/builtins/deliverables/system_prompt.md | 2 ++ .../agents/multi_agent_chat/test_prompt_resources.py | 7 ++++++- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/surfsense_backend/app/agents/chat/multi_agent_chat/main_agent/system_prompt/prompts/routing.md b/surfsense_backend/app/agents/chat/multi_agent_chat/main_agent/system_prompt/prompts/routing.md index 3372092e6..7ba06b2ad 100644 --- a/surfsense_backend/app/agents/chat/multi_agent_chat/main_agent/system_prompt/prompts/routing.md +++ b/surfsense_backend/app/agents/chat/multi_agent_chat/main_agent/system_prompt/prompts/routing.md @@ -77,10 +77,12 @@ web_crawler specialist to crawl and then save the data with its requests go to `task(deliverables, …)` with an explicit instruction to create an editable PPTX artifact. -**Report and resume artifacts.** Report, resume, and CV requests with no -explicit output format go to `task(deliverables, …)` with an explicit -instruction to create a PDF artifact. Do not ask the user to choose a format. -Preserve an explicit override: editable Word requests → DOCX, slides or a +**Report and resume artifacts.** Report, resume, CV, and submission-document +creation requests go to `task(deliverables, …)`. Unless the user specifies +another format, instruct the specialist to create a PDF artifact. Infer +non-critical details rather than asking follow-up questions or drafting the +document inline; brief follow-ups such as "just do it" preserve this intent. +Explicit format requests still win: editable Word → DOCX, slides or a presentation → PPTX, and a workbook or spreadsheet → XLSX. **Video media.** Requests whose requested output is a video, animation, or diff --git a/surfsense_backend/app/agents/chat/multi_agent_chat/main_agent/system_prompt/prompts/tools/task/description.md b/surfsense_backend/app/agents/chat/multi_agent_chat/main_agent/system_prompt/prompts/tools/task/description.md index cfd47b7fd..4750ca971 100644 --- a/surfsense_backend/app/agents/chat/multi_agent_chat/main_agent/system_prompt/prompts/tools/task/description.md +++ b/surfsense_backend/app/agents/chat/multi_agent_chat/main_agent/system_prompt/prompts/tools/task/description.md @@ -9,8 +9,8 @@ entry in ``). - `description` — the FULL task prompt. The specialist cannot see this thread, so include all context and constraints, plus what you need - back. The specialist will respond in its own format — don't dictate - one. + back. The specialist owns its response structure; preserve and explicitly + pass all user constraints, including any required artifact format. - Args (batch mode): - `tasks` — array of `{description, subagent_type}` objects to fan out concurrently. Mutually exclusive with single-mode args. Use when a diff --git a/surfsense_backend/app/agents/chat/multi_agent_chat/subagents/builtins/deliverables/system_prompt.md b/surfsense_backend/app/agents/chat/multi_agent_chat/subagents/builtins/deliverables/system_prompt.md index ddbf618c7..0799fe87d 100644 --- a/surfsense_backend/app/agents/chat/multi_agent_chat/subagents/builtins/deliverables/system_prompt.md +++ b/surfsense_backend/app/agents/chat/multi_agent_chat/subagents/builtins/deliverables/system_prompt.md @@ -26,6 +26,8 @@ what was generated. → XLSX. Plain notes, briefs, and content intended for continued editing → Markdown. An explicit format always overrides these defaults; otherwise, prefer PDF for a finished deliverable. +- For PDF-default requests, complete the PDF workflow rather than substituting + a Markdown-only artifact or an inline draft. - Available format skill: `pdf` — creates polished PDF files for PDFs, resumes, CVs, reports-as-PDF, letters, one-pagers, and printable documents. - Available format skill: `docx` — creates polished, editable Word documents diff --git a/surfsense_backend/tests/unit/agents/multi_agent_chat/test_prompt_resources.py b/surfsense_backend/tests/unit/agents/multi_agent_chat/test_prompt_resources.py index ed1d83bbd..7954dc3c8 100644 --- a/surfsense_backend/tests/unit/agents/multi_agent_chat/test_prompt_resources.py +++ b/surfsense_backend/tests/unit/agents/multi_agent_chat/test_prompt_resources.py @@ -66,6 +66,7 @@ def test_presentation_routing_separates_pptx_from_video(): def test_reports_and_resumes_default_to_pdf_without_format_clarification(): """Supervisor and specialist apply the canonical artifact format policy.""" routing = read_prompt_md("routing.md") + task_description = read_prompt_md("tools/task/description.md") deliverables_package = _route_resource_package( SUBAGENT_BUILDERS_BY_NAME["deliverables"] ) @@ -73,7 +74,9 @@ def test_reports_and_resumes_default_to_pdf_without_format_clarification(): assert "**Report and resume artifacts.**" in routing assert "create a PDF artifact" in routing - assert "Do not ask the user to choose a format." in routing + assert "rather than asking follow-up questions or drafting the" in routing + assert 'brief follow-ups such as "just do it" preserve this intent' in routing + assert "including any required artifact format" in task_description assert "Choose the output format from the user's intent without asking" in ( deliverables_prompt ) @@ -81,6 +84,8 @@ def test_reports_and_resumes_default_to_pdf_without_format_clarification(): deliverables_prompt ) assert "An omitted format is never a missing constraint" in deliverables_prompt + assert "rather than substituting" in deliverables_prompt + assert "a Markdown-only artifact or an inline draft" in deliverables_prompt assert ( '"artifact_type": "artifact" | "podcast" | "video_presentation" | "image"' in deliverables_prompt