-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Context
ADF currently communicates with agents via unstructured stdout/stderr pipes. This causes:
- SIGPIPE kills when stderr pipe is dropped
- Fragile text parsing for cost/session/status extraction
- No message framing, idempotency, or error typing
Proposal
Implement a JSONL envelope protocol inspired by Piwork's taskd RPC spec (docs/runtime-taskd-rpc-spec.md).
Envelope Format
Agent -> Orchestrator (event):
{"type": "event", "event": "cost_update", "agent": "security-sentinel", "ts": "...", "payload": {...}}Orchestrator -> Agent (command, future):
{"id": "req_01", "type": "pause", "payload": {"reason": "budget_exceeded"}}Key Properties
- Strict envelope:
{type, event/id, payload}(payload required even if empty) - Idempotency: duplicate request IDs with same payload produce no duplicate effects
- Typed error codes with retryable flag
- State recovery:
runtime_get_stateequivalent after reconnect
Integration
- For Claude agents: wrap
--output-format stream-jsonevents in ADF envelope - For Codex agents: gracefully degrade to unstructured mode
- New agents: require envelope support as spawn prerequisite
Benefits
- Foundation for cost tracking (Phase 1: Cost tracking with budget enforcement for ADF agents #638), session persistence (Phase 2: Session persistence for Claude Code agents in ADF #639), activity log (Phase 4: Structured activity log for ADF #641)
- Eliminates SIGPIPE bug (structured framing detects incomplete messages)
- Enables future Agent SDK migration
References
- Piwork taskd RPC spec: https://github.com/ferologics/Piwork/blob/main/docs/runtime-taskd-rpc-spec.md
- Plan:
cto-executive-system/plans/adf-architecture-improvements.md(item 1.3) - Blocks: Phase 1: Cost tracking with budget enforcement for ADF agents #638, Phase 2: Session persistence for Claude Code agents in ADF #639, Phase 4: Structured activity log for ADF #641
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request