Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### ⚠ BREAKING CHANGES

* **harness:** removed the deprecated bespoke LangGraph tracing handler `create_langgraph_tracing_handler` (and its `AgentexLangGraphTracingHandler` class) from the public `agentex.lib.adk` surface. Span tracing is now derived from the canonical `StreamTaskMessage*` stream by `UnifiedEmitter` — wrap your run in the harness `*Turn` and drive `UnifiedEmitter.yield_turn` / `auto_send_turn`. The `agentex init` templates were migrated accordingly.
* **harness:** removed the deprecated bespoke Pydantic-AI tracing handler `create_pydantic_ai_tracing_handler` (and its `AgentexPydanticAITracingHandler` class) from the public `agentex.lib.adk` surface. Span tracing is now derived from the canonical `StreamTaskMessage*` stream by `UnifiedEmitter` — wrap your run in `PydanticAITurn` and drive `UnifiedEmitter.yield_turn` / `auto_send_turn`. The `agentex init` templates were migrated accordingly.
* **harness:** each harness now exposes exactly `_<harness>_sync.py` + `_<harness>_turn.py` under `agentex.lib.adk._modules`. The OpenAI harness `OpenAITurn` and `convert_openai_to_agentex_events` moved to `agentex.lib.adk._modules._openai_turn` / `_openai_sync`; back-compat shims remain at `agentex.lib.adk.providers._modules.{openai_turn,sync_provider}` for one release. Public facade names (`stream_pydantic_ai_events`, `stream_langgraph_events`, `emit_langgraph_messages`, etc.) are unchanged.

### Features
Expand Down
5 changes: 1 addition & 4 deletions src/agentex/lib/adk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@
emit_langgraph_messages,
convert_langgraph_to_agentex_events,
)
from agentex.lib.adk._modules._pydantic_ai_async import stream_pydantic_ai_events
from agentex.lib.adk._modules._pydantic_ai_turn import PydanticAITurn, stream_pydantic_ai_events
from agentex.lib.adk._modules._pydantic_ai_sync import convert_pydantic_ai_to_agentex_events
from agentex.lib.adk._modules._pydantic_ai_tracing import create_pydantic_ai_tracing_handler
from agentex.lib.adk._modules._pydantic_ai_turn import PydanticAITurn
from agentex.lib.adk._modules._claude_code_sync import convert_claude_code_to_agentex_events
from agentex.lib.adk._modules._claude_code_turn import (
ClaudeCodeTurn,
Expand Down Expand Up @@ -75,7 +73,6 @@
# Pydantic AI
"stream_pydantic_ai_events",
"convert_pydantic_ai_to_agentex_events",
"create_pydantic_ai_tracing_handler",
"PydanticAITurn",
# Claude Code
"convert_claude_code_to_agentex_events",
Expand Down
65 changes: 0 additions & 65 deletions src/agentex/lib/adk/_modules/_pydantic_ai_async.py

This file was deleted.

38 changes: 1 addition & 37 deletions src/agentex/lib/adk/_modules/_pydantic_ai_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,9 @@ async def handle_message_send(params):

import json
import inspect
from typing import TYPE_CHECKING, Any, Callable, AsyncIterator
from typing import Any, Callable, AsyncIterator

from pydantic_ai.run import AgentRunResultEvent

if TYPE_CHECKING:
from agentex.lib.adk._modules._pydantic_ai_tracing import (
AgentexPydanticAITracingHandler,
)
from pydantic_ai.messages import (
TextPart,
PartEndEvent,
Expand Down Expand Up @@ -124,7 +119,6 @@ def _tool_return_content(result: ToolReturnPart | Any) -> Any:

async def convert_pydantic_ai_to_agentex_events(
stream_response: AsyncIterator[Any],
tracing_handler: "AgentexPydanticAITracingHandler | None" = None,
on_result: Callable[[AgentRunResultEvent], Any] | None = None,
) -> AsyncIterator[StreamTaskMessageStart | StreamTaskMessageDelta | StreamTaskMessageFull | StreamTaskMessageDone]:
"""Convert a Pydantic AI agent event stream into Agentex stream events.
Expand All @@ -148,11 +142,6 @@ async def convert_pydantic_ai_to_agentex_events(
stream_response: The async iterator yielded by Pydantic AI's
``agent.run_stream_events(...)`` context manager (or a stream of
``AgentStreamEvent`` items received in an ``event_stream_handler``).
tracing_handler: Optional handler from
``create_pydantic_ai_tracing_handler(...)``. When provided, each
tool call in the run is also recorded as an Agentex child span
beneath the handler's configured ``parent_span_id``. Streaming
behavior is unchanged when omitted.
on_result: Optional callback invoked with the terminal
``AgentRunResultEvent`` when the run completes. Both sync and
async callables are accepted. No ``StreamTaskMessage*`` events are
Expand Down Expand Up @@ -306,26 +295,6 @@ async def convert_pydantic_ai_to_agentex_events(
if message_index is None:
continue
yield StreamTaskMessageDone(type="done", index=message_index)
# Tool-call parts end with the model's full args known. Open a
# tracing child span for the tool execution now; close it when
# FunctionToolResultEvent arrives below.
if tracing_handler is not None and isinstance(event.part, ToolCallPart) and event.part.tool_call_id:
args: dict[str, Any] | str | None
raw_args = event.part.args
if isinstance(raw_args, dict):
args = dict(raw_args)
elif isinstance(raw_args, str):
try:
args = json.loads(raw_args) if raw_args else {}
except json.JSONDecodeError:
args = {"_raw": raw_args}
else:
args = {}
await tracing_handler.on_tool_start(
tool_call_id=event.part.tool_call_id,
tool_name=event.part.tool_name,
arguments=args,
)

elif isinstance(event, FunctionToolResultEvent):
result = event.part
Expand All @@ -345,11 +314,6 @@ async def convert_pydantic_ai_to_agentex_events(
content=content_payload,
),
)
if tracing_handler is not None and tool_call_id:
await tracing_handler.on_tool_end(
tool_call_id=tool_call_id,
result=content_payload,
)

elif isinstance(event, (FunctionToolCallEvent, FinalResultEvent, AgentRunResultEvent)):
# Already covered by PartStart/PartDelta/PartEnd events above, or
Expand Down
221 changes: 0 additions & 221 deletions src/agentex/lib/adk/_modules/_pydantic_ai_tracing.py

This file was deleted.

Loading
Loading