From beaf4f8b9c7d87d6a31900e4f949cec460d861e0 Mon Sep 17 00:00:00 2001 From: rasulkireev <8257474+rasulkireev@users.noreply.github.com> Date: Tue, 10 Feb 2026 15:58:56 +0000 Subject: [PATCH] Fix empty system prompts for Sonar provider --- core/agents/system_prompts.py | 7 +++++-- core/agents/title_suggestions_agent.py | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/core/agents/system_prompts.py b/core/agents/system_prompts.py index 540d301e..f0e1448e 100644 --- a/core/agents/system_prompts.py +++ b/core/agents/system_prompts.py @@ -110,7 +110,9 @@ def add_project_pages(ctx: RunContext) -> str: return instruction else: - return "" + # Some providers (e.g. Perplexity Sonar) reject empty system messages. + # Return an explicit no-op instruction instead of an empty string. + return "No internal project pages were provided for linking. Do not add internal links unless explicit URLs are provided in context." def add_title_details(ctx: RunContext[BlogPostGenerationContext]) -> str: @@ -150,7 +152,8 @@ def add_target_keywords(ctx: RunContext[BlogPostGenerationContext]) -> str: Don't make them bold, just a regular part of the text. """ # noqa: E501 else: - return "" + # Some providers reject empty system messages; keep this non-empty. + return "No specific SEO focus keywords were provided." def add_webpage_content(ctx: RunContext[WebPageContent]) -> str: diff --git a/core/agents/title_suggestions_agent.py b/core/agents/title_suggestions_agent.py index 417e92ed..a45fd264 100644 --- a/core/agents/title_suggestions_agent.py +++ b/core/agents/title_suggestions_agent.py @@ -51,7 +51,8 @@ def add_language_specification(ctx: RunContext[TitleSuggestionContext]) -> str: @agent.system_prompt def add_user_prompt(ctx: RunContext[TitleSuggestionContext]) -> str: if not ctx.deps.user_prompt: - return "" + # Some providers reject empty system messages. + return "No additional user prompt was provided." return f""" IMPORTANT USER REQUEST: The user has specifically requested the following: