refactor(cli): migrate existing langgraph/pydantic-ai templates to unified surface#429
Merged
Merged
Conversation
f35bef7 to
b3efb55
Compare
50a0533 to
a6a4a30
Compare
2 tasks
b3efb55 to
1e6b84c
Compare
a6a4a30 to
fb4111f
Compare
Contributor
Author
|
@greptile review |
Contributor
Author
|
@greptile review |
1e6b84c to
5f23b89
Compare
fb4111f to
c9f7ab7
Compare
5f23b89 to
f06e819
Compare
c9f7ab7 to
8debccd
Compare
danielmillerp
approved these changes
Jun 23, 2026
f06e819 to
9b36537
Compare
…ified surface Update the scaffolded acp.py / agent.py for default-langgraph, default-pydantic-ai, sync-langgraph, sync-pydantic-ai and temporal-pydantic-ai to the canonical unified harness surface, matching the migrated tutorials. Promote LangGraphTurn and PydanticAITurn to the public agentex.lib.adk facade (parallel to ClaudeCodeTurn / CodexTurn) so the scaffolded user code imports them from the stable public path instead of a private _modules path. Non-breaking: template scaffolding + additive public exports only. The unified surface already exists; deprecated tracing handlers are removed in follow-ups. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
8debccd to
758d5f8
Compare
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Third slice of #425. Migrates the existing
agentex inittemplates onto the unified harness surface, matching the tutorial migration in #428.default-langgraph,default-pydantic-ai,sync-langgraph,sync-pydantic-ai,temporal-pydantic-ai: scaffoldedacp.py/agent.pynow use the unified surface.Test plan
pytest tests/lib/cli/ -k "init or template"— 19 passed (all templates render to valid Python)Notes
Stacked on #428 (base =
declan-scale/tutorials-unified-surface). Retarget tonextafter #428 merges.🤖 Generated with Claude Code
Greptile Summary
This PR is the third slice of the unified harness surface migration, updating the five existing
agentex initscaffolding templates (default-langgraph,default-pydantic-ai,sync-langgraph,sync-pydantic-ai,temporal-pydantic-ai) to useUnifiedEmitter+ the new*Turnclasses instead of the oldstream_*_eventshelpers and LangChain callback tracing handlers.LangGraphTurnandPydanticAITurnare promoted to the publicagentex.lib.adkfacade (__all__), ensuring generated user project files import only from the stable public API.create_*_tracing_handler/stream_*_events/convert_*_to_agentex_eventscalls replaced byLangGraphTurn/PydanticAITurn+emitter.yield_turnoremitter.auto_send_turn, matching the pattern established in the tutorials PR (refactor(tutorials): migrate to the unified harness surface + renumber #428).Confidence Score: 5/5
Safe to merge; all five templates correctly adopt the unified harness surface with no new functional regressions introduced.
The changes are mechanical migrations: old helpers replaced with Turn + UnifiedEmitter, public exports promoted for the two new Turn classes, and import paths cleaned up. The core delivery logic (auto_send_turn, yield_turn, SpanDeriver/SpanTracer) is unchanged and already reviewed in the harness PR. MODEL_NAME imports are valid in both pydantic-ai agent templates, and the tee_messages capture pattern in default-pydantic-ai is preserved correctly.
temporal-pydantic-ai/project/agent.py.j2 carries a pre-existing open question about per-activity SpanTracer lifecycle under TemporalAgent (flagged in a prior review round); no new issues introduced here.
Important Files Changed
Sequence Diagram
%%{init: {'theme': 'neutral'}}%% sequenceDiagram participant ACP as acp.py (template) participant UE as UnifiedEmitter participant Turn as LangGraphTurn / PydanticAITurn participant SD as SpanDeriver participant ST as SpanTracer participant Str as adk.streaming (Redis) Note over ACP,Str: async (default-*) templates — auto_send_turn path ACP->>UE: UnifiedEmitter(task_id, trace_id, parent_span_id) UE->>ST: SpanTracer(trace_id, parent_span_id) ACP->>Turn: "LangGraphTurn(stream, model=None) / PydanticAITurn(stream, model=MODEL_NAME)" ACP->>UE: auto_send_turn(turn) UE->>SD: SpanDeriver() loop for each StreamTaskMessage event Turn-->>UE: event UE->>SD: observe(event) SD-->>UE: SpanSignals (OpenSpan / CloseSpan) UE->>ST: handle(signal) → start_span / end_span UE->>Str: streaming_task_message_context / stream_update end UE->>SD: flush() → close unclosed spans UE-->>ACP: TurnResult(final_text, usage) Note over ACP,Str: sync (sync-*) templates — yield_turn path ACP->>UE: UnifiedEmitter(task_id, trace_id, parent_span_id) ACP->>Turn: LangGraphTurn / PydanticAITurn ACP->>UE: yield_turn(turn) loop for each event Turn-->>UE: event UE->>SD: observe(event) → SpanSignals UE->>ST: handle(signal) UE-->>ACP: yield event end%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%% sequenceDiagram participant ACP as acp.py (template) participant UE as UnifiedEmitter participant Turn as LangGraphTurn / PydanticAITurn participant SD as SpanDeriver participant ST as SpanTracer participant Str as adk.streaming (Redis) Note over ACP,Str: async (default-*) templates — auto_send_turn path ACP->>UE: UnifiedEmitter(task_id, trace_id, parent_span_id) UE->>ST: SpanTracer(trace_id, parent_span_id) ACP->>Turn: "LangGraphTurn(stream, model=None) / PydanticAITurn(stream, model=MODEL_NAME)" ACP->>UE: auto_send_turn(turn) UE->>SD: SpanDeriver() loop for each StreamTaskMessage event Turn-->>UE: event UE->>SD: observe(event) SD-->>UE: SpanSignals (OpenSpan / CloseSpan) UE->>ST: handle(signal) → start_span / end_span UE->>Str: streaming_task_message_context / stream_update end UE->>SD: flush() → close unclosed spans UE-->>ACP: TurnResult(final_text, usage) Note over ACP,Str: sync (sync-*) templates — yield_turn path ACP->>UE: UnifiedEmitter(task_id, trace_id, parent_span_id) ACP->>Turn: LangGraphTurn / PydanticAITurn ACP->>UE: yield_turn(turn) loop for each event Turn-->>UE: event UE->>SD: observe(event) → SpanSignals UE->>ST: handle(signal) UE-->>ACP: yield event endReviews (6): Last reviewed commit: "refactor(cli): migrate existing langgrap..." | Re-trigger Greptile