Skip to content

The agent that grows with you

fix(agent): scope async yield guidance to delegation

JoaoMarcos4496a8cecd3905
diff --git a/agent/system_prompt.py b/agent/system_prompt.py
index 853462571cc..d9a4ce8086e 100644
--- a/agent/system_prompt.py
+++ b/agent/system_prompt.py
@@ -19,7 +19,7 @@ from typing import Any, Dict, List, Optional, Tuple
from agent.delegation_context import owned_kanban_task
from agent.prompt_builder import (
- DEFAULT_AGENT_IDENTITY, EXECUTION_GUIDANCE_MODELS, GOOGLE_MODEL_OPERATIONAL_GUIDANCE,
+ ASYNC_HANDOFF_GUIDANCE, DEFAULT_AGENT_IDENTITY, EXECUTION_GUIDANCE_MODELS, GOOGLE_MODEL_OPERATIONAL_GUIDANCE,
HERMES_AGENT_HELP_GUIDANCE, HERMES_AGENT_HELP_GUIDANCE_NO_SKILLS, KANBAN_GUIDANCE,
PARALLEL_TOOL_CALL_GUIDANCE, PLATFORM_HINTS, SESSION_SEARCH_GUIDANCE,
SKILLS_GUIDANCE, STEER_CHANNEL_NOTE, TASK_COMPLETION_GUIDANCE, TELEGRAM_RICH_MESSAGES_HINT,
@@ -575,6 +575,10 @@ def _guidance_parts(agent: Any) -> List[str]:
if _model_gate(getattr(agent, "_execution_guidance", "auto"), agent.model, EXECUTION_GUIDANCE_MODELS):
from agent.prompt_builder import execution_guidance_text
parts.append(execution_guidance_text())
+ # delegate_task background delivery is intentionally between turns. Put this after the generic persistence
+ # blocks so their "keep working" rule cannot turn the required yield into no-op/polling activity.
+ if "delegate_task" in agent.valid_tool_names:
+ parts.append(ASYNC_HANDOFF_GUIDANCE)
return parts