Skip to content

Agent Runtime Protocol Specification

Document ID: AGENT-009
File Path: docs/04-agent-framework/agent-runtime-protocol.md
Version: 1.0.0
Status: Draft
Owner: AI Platform Team
Last Updated: 2026-06-26


The Agent Runtime Protocol defines the canonical execution contract between all core subsystems of the Wovyr AI Platform:

  • Workflow Engine
  • Agent Runtime
  • Tool Framework
  • Memory System
  • Provider SDK
  • Policy Engine
  • Multi-Agent Coordination

It ensures every agent execution is deterministic, observable, secure, and reproducible across distributed environments.


The protocol shall provide:

  • Standardized execution lifecycle
  • Cross-system communication contract
  • Deterministic state transitions
  • Streaming execution support
  • Failure recovery semantics
  • Distributed execution consistency
  • Observability hooks
  • Replay capability

  1. Every execution is stateful and traceable.
  2. Every state transition is event-driven.
  3. All subsystems communicate via typed events.
  4. No subsystem directly mutates another subsystem’s state.
  5. Execution is replayable from logs alone.
  6. Failures are explicit states, not exceptions.
  7. Streaming is first-class.

Workflow Engine
Agent Runtime (Protocol Core)
├──────────────┬──────────────┬──────────────┐
▼ ▼ ▼ ▼
Policy Engine Memory System Tool Framework Provider SDK
│ │ │ │
└──────────────┼──────────────┼──────────────┘
Multi-Agent Coordination
Execution Results

Each agent execution follows a strict lifecycle:

CREATED
VALIDATED
PLANNED
CONTEXT_BUILT
POLICY_CHECKED
EXECUTING
STREAMING (optional)
TOOL_INVOKED (optional)
COMPLETED
PERSISTED
ARCHIVED

Failure states:

FAILED
RETRYING
CANCELLED
TIMED_OUT
DENIED

executionId:
workflowId:
agentId:
tenantId:
goal:
input:
contextId:
priority:
timeout:
retryPolicy:
metadata:

The runtime context is immutable once created:

context:
workflowState:
memorySnapshot:
toolCapabilities:
policySnapshot:
providerSelection:
tokenBudget:
traceId:

All communication occurs via events.

ExecutionCreated
ExecutionValidated
ExecutionPlanned
ContextBuilt
PolicyEvaluated
ToolInvoked
ProviderCalled
MemoryQueried
AgentDelegated
ExecutionCompleted
ExecutionFailed
ExecutionCancelled

eventId:
eventType:
executionId:
workflowId:
timestamp:
source:
payload:
correlationId:
traceId:

Events are immutable and append-only.


Streaming uses chunked event delivery.

START
CHUNK
CHUNK
CHUNK
FINAL
COMPLETE

Each chunk is independently verifiable.


Tool execution follows a strict request-response protocol:

Agent Runtime
Tool Dispatcher
Policy Engine Check
Sandbox Execution
Result Stream
Response Aggregation

Tool results are normalized before returning to the agent.


LLM calls follow:

Context Manager
Provider SDK
Provider Router
Model Execution
Response Stream
Token Accounting

Provider responses are mapped into a unified format.


Memory operations are read-heavy and event-tracked:

  • Retrieve
  • Store
  • Update
  • Embed
  • Search

All memory access is policy-checked.


Before ANY execution step:

Policy Engine Evaluate()

Decision outcomes:

  • ALLOW → continue
  • DENY → terminate
  • CONDITIONAL → require approval
  • RETRY → re-evaluate later

Delegation flow:

Agent A
Coordination Manager
Agent Registry
Agent B Assigned
Message Bus
Execution Continues

All delegations are trace-linked.


Rules:

  • States are strictly ordered
  • No skipping states
  • Invalid transitions are rejected
  • Retry resets EXECUTING state only
  • Failure states are terminal unless retried

Each execution state can be checkpointed:

Execution State Snapshot:
- currentState
- completedSteps
- memoryDiff
- toolOutputs
- providerState

Checkpoint enables full recovery.


Executions may migrate across nodes:

Node A → Node B → Node C

Rules:

  • Execution ID remains constant
  • State is synchronized via event log
  • No duplicate execution allowed
  • At-most-once tool execution guarantee

Retry policies:

  • Immediate retry
  • Backoff retry
  • Failover provider retry
  • Alternate tool retry

Retries preserve execution context.


Errors are classified:

TypeDescription
ValidationErrorInvalid input
PolicyDeniedSecurity violation
ToolFailureTool execution error
ProviderFailureLLM failure
TimeoutExecution exceeded limit
SystemFailureInfrastructure issue

All errors are evented.


The protocol exposes:

  • Traces
  • Metrics
  • Logs
  • Execution DAG
  • State transitions

OpenTelemetry-compatible tracing is required.


  • mTLS for all communication
  • Signed events
  • Tenant isolation
  • Secret redaction
  • Policy enforcement before execution
  • No raw secret exposure to LLM

pub trait AgentRuntimeProtocol {
fn execute(request: ExecutionRequest) -> ExecutionHandle;
fn stream(execution_id: ExecutionId) -> EventStream;
fn cancel(execution_id: ExecutionId) -> Result<()>;
fn checkpoint(execution_id: ExecutionId) -> Result<()>;
}

engine-runtime-protocol/
├── lifecycle/
├── events/
├── execution/
├── streaming/
├── state-machine/
├── checkpoint/
├── distributed/
├── errors/
├── security/
└── mod.rs

  • State transitions
  • Event validation
  • Retry logic
  • Error classification
  • Tool Framework
  • Memory System
  • Provider SDK
  • Policy Engine
  • Multi-node execution
  • Failover recovery
  • Event consistency
  • Checkpoint restoration

RequirementTarget
State transition latency< 5 ms
Event emission< 2 ms
Execution dispatch< 10 ms
Checkpoint restore< 200 ms
Availability99.99%

  • docs/03-workflow-engine/state-machine.md
  • docs/03-workflow-engine/event-bus.md
  • docs/03-workflow-engine/distributed-execution.md
  • docs/04-agent-framework/tool-framework.md
  • docs/04-agent-framework/policy-engine.md

  • docs/04-agent-framework/agent-definition.md
  • docs/04-agent-framework/context-manager.md
  • docs/04-agent-framework/multi-agent-coordination.md

  • Zero-copy execution protocol
  • WASM-native agent runtime
  • GPU-accelerated execution paths
  • Self-healing execution graphs
  • AI-driven runtime optimization
  • Cross-cloud execution federation

VersionDateDescription
1.0.02026-06-26Initial Agent Runtime Protocol Specification