Skip to content

Commit b7ac944

Browse files
committed
fix(showcase/langgraph-python): surface explicit sentinel for empty sub-agent results
_invoke_sub_agent's last-resort branch silently returned '' or a Python repr like \"[{'type': 'text', ...}]\" for block-list content, which the UI would render as a blank/garbled card. Return a stable SUB_AGENT_EMPTY_SENTINEL ('<sub-agent produced no output>') instead so the d5-subagents probe can match it against its boilerplate-marker list and fail the genuine-pass test loudly when a sub-agent produces no usable output.
1 parent 447c3d4 commit b7ac944

1 file changed

Lines changed: 14 additions & 4 deletions

File tree

  • showcase/integrations/langgraph-python/src/agents

showcase/integrations/langgraph-python/src/agents/subagents.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,13 @@ class AgentState(BaseAgentState):
105105
# @endregion[subagent-setup]
106106

107107

108+
# Sentinel surfaced when a sub-agent run produces no usable text. Kept
109+
# as a module-level constant so the harness probe (and any UI fallback)
110+
# can match the exact phrase. The leading/trailing angle brackets keep
111+
# it out of plausible LLM phrasing.
112+
SUB_AGENT_EMPTY_SENTINEL = "<sub-agent produced no output>"
113+
114+
108115
def _invoke_sub_agent(agent, task: str) -> str:
109116
"""Run a sub-agent on `task` and return its final prose message.
110117
@@ -139,10 +146,13 @@ def _invoke_sub_agent(agent, task: str) -> str:
139146
joined = "".join(parts).strip()
140147
if joined:
141148
return joined
142-
# Last-resort fallback: stringify the final message content if any.
143-
if messages:
144-
return str(messages[-1].content)
145-
return ""
149+
# Last-resort fallback: surface an explicit sentinel rather than ""
150+
# or a Python repr like "[{'type': 'text', ...}]" leaking from a
151+
# block-list `content`. The d5-subagents probe asserts this exact
152+
# sentinel against its boilerplate-marker list so an empty/garbled
153+
# sub-agent result fails the genuine-pass test instead of silently
154+
# rendering an empty card.
155+
return SUB_AGENT_EMPTY_SENTINEL
146156

147157

148158
def _delegation_update(

0 commit comments

Comments
 (0)