Skip to content

Commit ee8aa4c

Browse files
declan-scaleclaude
andcommitted
docs(harness): refresh harness.md to the merged surface (all five taps, canonical yield_turn example)
Completes the taps table with claude-code/codex/openai, names the per-harness HarnessTurn wrappers, and replaces the pre-unified sync example (which left UnifiedEmitter unused) with the canonical emitter.yield_turn(turn) flow. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent f88cec7 commit ee8aa4c

1 file changed

Lines changed: 12 additions & 8 deletions

File tree

adk/docs/harness.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,17 @@ Every harness tap produces a sequence of these. Everything downstream (delivery,
3939

4040
## Per-harness taps: `convert_<harness>_to_agentex_events`
4141

42-
A tap is an async generator that translates the harness's native event stream into `StreamTaskMessage*` events. The currently shipped taps are:
42+
A tap is an async generator that translates the harness's native event stream into `StreamTaskMessage*` events. The shipped taps are:
4343

4444
| Harness | Tap function | Exported from |
4545
|---|---|---|
4646
| pydantic-ai | `convert_pydantic_ai_to_agentex_events` | `agentex.lib.adk` |
4747
| LangGraph | `convert_langgraph_to_agentex_events` | `agentex.lib.adk` |
48+
| claude-code | `convert_claude_code_to_agentex_events` | `agentex.lib.adk` |
49+
| codex | `convert_codex_to_agentex_events` | `agentex.lib.adk` |
50+
| OpenAI Agents | `convert_openai_to_agentex_events` | `agentex.lib.adk.providers._modules.sync_provider` |
4851

49-
Taps for claude-code and codex will be added in subsequent PRs (AGX1-420, AGX1-421) and exported from `agentex.lib.adk` in the same way.
52+
Each harness also provides a `HarnessTurn` wrapper that pairs its tap's event stream with usage extraction: `PydanticAITurn`, `LangGraphTurn`, `ClaudeCodeTurn`, `CodexTurn`, and `OpenAITurn`.
5053

5154
---
5255

@@ -157,11 +160,13 @@ Spans are derived from the canonical stream by `SpanDeriver` (pure, no `adk` dep
157160

158161
## Usage examples by channel
159162

160-
### Sync ACP (pydantic-ai tap)
163+
### Sync ACP (`yield_turn`)
164+
165+
Build the harness's `HarnessTurn` wrapper and iterate `emitter.yield_turn(turn)` — the emitter forwards each event to the caller and traces spans as a side effect:
161166

162167
```python
163168
import agentex.lib.adk as adk
164-
from agentex.lib.adk import UnifiedEmitter, convert_pydantic_ai_to_agentex_events
169+
from agentex.lib.adk import UnifiedEmitter, ClaudeCodeTurn
165170

166171
@acp.on_message_send
167172
async def handle(params):
@@ -172,13 +177,12 @@ async def handle(params):
172177
trace_id=task_id,
173178
parent_span_id=turn_span.id if turn_span else None,
174179
)
175-
tap = convert_pydantic_ai_to_agentex_events(pydantic_stream)
176-
# wrap tap in a HarnessTurn then yield_turn, or yield directly:
177-
async for event in tap:
180+
turn = ClaudeCodeTurn(claude_code_stream) # any HarnessTurn
181+
async for event in emitter.yield_turn(turn):
178182
yield event
179183
```
180184

181-
For the pre-unified sync path the tap is still yielded directly; `UnifiedEmitter.yield_turn` is the forward-looking integration point when a `HarnessTurn` wrapper is available.
185+
Every harness follows the same shape — swap `ClaudeCodeTurn` for `PydanticAITurn`, `LangGraphTurn`, `CodexTurn`, or `OpenAITurn` and feed it that harness's native stream.
182186

183187
### Async Temporal (auto-send)
184188

0 commit comments

Comments
 (0)