Skip to content

Implement JSONL RPC envelope for agent-orchestrator communication #688

@AlexMikhalev

Description

@AlexMikhalev

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_state equivalent after reconnect

Integration

  • For Claude agents: wrap --output-format stream-json events in ADF envelope
  • For Codex agents: gracefully degrade to unstructured mode
  • New agents: require envelope support as spawn prerequisite

Benefits

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions