GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(langgraph): sync tutorial span output stores final text, not usag… · scaleapi/scale-agentex-python@6ac00e3

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • examples/tutorials/00_sync/harness_langgraph/project
    • acp.py
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎examples/tutorials/00_sync/harness_langgraph/project/acp.py‎

Copy file name to clipboardExpand all lines: examples/tutorials/00_sync/harness_langgraph/project/acp.py
+8-1Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
from agentex.lib.utils.logging import make_logger
3434
from agentex.lib.sdk.fastacp.fastacp import FastACP
3535
from agentex.lib.core.harness.emitter import UnifiedEmitter
36+
from agentex.types.task_message_delta import TextDelta
3637
from agentex.types.task_message_update import TaskMessageUpdate
3738
from agentex.types.task_message_content import TaskMessageContent
3839
from agentex.lib.adk._modules._langgraph_turn import LangGraphTurn
@@ -93,8 +94,14 @@ async def handle_message_send(
9394
parent_span_id=turn_span.id if turn_span else None,
9495
)
9596

97+
final_text = ""
9698
async for event in emitter.yield_turn(turn):
99+
# Accumulate text deltas so the span's final_output is the assistant
100+
# text (matching the async tutorial), not the usage metrics.
101+
delta = getattr(event, "delta", None)
102+
if isinstance(delta, TextDelta) and delta.text_delta:
103+
final_text += delta.text_delta
97104
yield event
98105

99106
if turn_span:
100-
turn_span.output = {"final_output": turn.usage().model_dump()}
107+
turn_span.output = {"final_output": final_text, "usage": turn.usage().model_dump()}

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.