Skip to content

Environment Capability Specification

Capability Identity

PropertyValue
EnumA2ECapability.ENV
String"env"
Plugin TypeEnvPlugin
Namespaceenv/*
Message Count15

Overview

The environment capability provides RL-style (Reinforcement Learning) step-wise interaction between Agent and Environment. It defines the core primitives for agentic loops: reset an episode, take a step, observe state, and receive rewards.

Core primitives:

  • reset — Initialize a new episode, return initial state
  • step — Execute action, receive (next_state, reward, done, info)
  • observe — Read-only current state without acting

Extended primitives:

  • close — Terminate an episode early
  • spaces — Discover action/state space definitions
  • render — Retrieve visual/multimodal representation
  • plan — Get environment-suggested affordances/actions
  • batch_step — Execute multiple steps in parallel

Server-initiated:

  • state/push — Incremental state update pushed to agent

Cross-capability integration:

  • Each env/step interaction can be auto-recorded as an (s, a, r, s', done) tuple in the ExperienceBuffer
  • Reward signals can be forwarded to the learning subsystem (learn/*)
  • Enables RL training loops, simulations, and CUA/browser environments

Protocol Flow

Message Types (15)

Reset (2)

env/reset/req — EnvResetRequest

Agent → Host. Initialize a new episode.

FieldTypeRequiredDefaultDescription
typestrYes"env/reset/req"Message type
idstrYesautoMessage UUID
versionstrYes"1.0"Protocol version
tsfloatYesautoTimestamp
env_namestrYesEnvironment identifier
seedintNoNoneRandom seed for reproducibility
optionsdict[str, Any]No{}Environment-specific options

env/reset/resp — EnvResetResponse

Host → Agent. Returns initial observation.

FieldTypeRequiredDefaultDescription
typestrYes"env/reset/resp"Message type
idstrYesautoMessage UUID
versionstrYes"1.0"Protocol version
tsfloatYesautoTimestamp
req_idstrYes""Echoes request ID
obsEnvObservationYesInitial observation

Step (2) — Core RL Primitive

env/step/req — EnvStepRequest

Agent → Host. Execute an action in the environment.

FieldTypeRequiredDefaultDescription
typestrYes"env/step/req"Message type
idstrYesautoMessage UUID
versionstrYes"1.0"Protocol version
tsfloatYesautoTimestamp
episode_idstrYesActive episode identifier
actiondict[str, Any]YesAction to execute

env/step/resp — EnvStepResponse

Host → Agent. Returns observation after action.

FieldTypeRequiredDefaultDescription
typestrYes"env/step/resp"Message type
idstrYesautoMessage UUID
versionstrYes"1.0"Protocol version
tsfloatYesautoTimestamp
req_idstrYes""Echoes request ID
obsEnvObservationYesPost-action observation

Observe (2) — Read-only State

env/observe/req — EnvObserveRequest

Agent → Host. Retrieve current state without acting.

FieldTypeRequiredDefaultDescription
typestrYes"env/observe/req"Message type
idstrYesautoMessage UUID
versionstrYes"1.0"Protocol version
tsfloatYesautoTimestamp
episode_idstrYesEpisode to observe

env/observe/resp — EnvObserveResponse

Host → Agent. Returns current observation.

FieldTypeRequiredDefaultDescription
typestrYes"env/observe/resp"Message type
idstrYesautoMessage UUID
versionstrYes"1.0"Protocol version
tsfloatYesautoTimestamp
req_idstrYes""Echoes request ID
obsEnvObservationYesCurrent observation

Close (2) — End Episode

env/close/req — EnvCloseRequest

Agent → Host. Terminate an episode early.

FieldTypeRequiredDefaultDescription
typestrYes"env/close/req"Message type
idstrYesautoMessage UUID
versionstrYes"1.0"Protocol version
tsfloatYesautoTimestamp
episode_idstrYesEpisode to close

env/close/resp — EnvCloseResponse

Host → Agent.

FieldTypeRequiredDefaultDescription
typestrYes"env/close/resp"Message type
idstrYesautoMessage UUID
versionstrYes"1.0"Protocol version
tsfloatYesautoTimestamp
closedboolYesTrueWhether close succeeded

Spaces (2) — Action/State Discovery

env/space/req — EnvSpacesRequest

Agent → Host. Discover action and state space definitions.

FieldTypeRequiredDefaultDescription
typestrYes"env/space/req"Message type
idstrYesautoMessage UUID
versionstrYes"1.0"Protocol version
tsfloatYesautoTimestamp
env_namestrYesEnvironment identifier

env/space/resp — EnvSpacesResponse

Host → Agent.

FieldTypeRequiredDefaultDescription
typestrYes"env/space/resp"Message type
idstrYesautoMessage UUID
versionstrYes"1.0"Protocol version
tsfloatYesautoTimestamp
action_spacedict[str, Any]YesJSON Schema defining valid actions
state_schemadict[str, Any]YesJSON Schema defining state structure

Render (2) — Multimodal Support

env/render/req — EnvRenderRequest

Agent → Host. Retrieve visual/multimodal representation of current state.

FieldTypeRequiredDefaultDescription
typestrYes"env/render/req"Message type
idstrYesautoMessage UUID
versionstrYes"1.0"Protocol version
tsfloatYesautoTimestamp
episode_idstrYesEpisode to render
modestrNo"screenshot"Render mode: screenshot, rgb_array, text

env/render/resp — EnvRenderResponse

Host → Agent.

FieldTypeRequiredDefaultDescription
typestrYes"env/render/resp"Message type
idstrYesautoMessage UUID
versionstrYes"1.0"Protocol version
tsfloatYesautoTimestamp
renderAnyYesRendered output (bytes, base64, or structured)

Plan (2) — Affordance Discovery

env/plan/req — EnvPlanRequest

Agent → Host. Get environment-suggested actions.

FieldTypeRequiredDefaultDescription
typestrYes"env/plan/resp"Message type (note: shares resp value)
idstrYesautoMessage UUID
versionstrYes"1.0"Protocol version
tsfloatYesautoTimestamp
episode_idstrNoNoneOptional episode context
statedict[str, Any]NoNoneOptional state context

env/plan/resp — EnvPlanResponse

Host → Agent.

FieldTypeRequiredDefaultDescription
typestrYes"env/plan/resp"Message type
idstrYesautoMessage UUID
versionstrYes"1.0"Protocol version
tsfloatYesautoTimestamp
suggested_actionslist[dict[str, Any]]Yes[]Suggested actions with descriptions

Batch Step (2) — Parallel Execution

env/batch_step/req — EnvBatchStepRequest

Agent → Host. Execute multiple actions in parallel across episodes.

FieldTypeRequiredDefaultDescription
typestrYes"env/batch_step/req"Message type
idstrYesautoMessage UUID
versionstrYes"1.0"Protocol version
tsfloatYesautoTimestamp
episode_idslist[str]YesEpisode identifiers
actionslist[dict[str, Any]]YesActions (1:1 with episode_ids)

env/batch_step/resp — EnvBatchStepResponse

Host → Agent.

FieldTypeRequiredDefaultDescription
typestrYes"env/batch_step/resp"Message type
idstrYesautoMessage UUID
versionstrYes"1.0"Protocol version
tsfloatYesautoTimestamp
resultslist[EnvStepResponse]YesResults (1:1 with request)

State Push (1) — Server-initiated

env/state/push — EnvStatePush

Host → Agent (server-initiated). Incremental environment state update.

FieldTypeRequiredDefaultDescription
typestrYes"env/state/push"Message type
idstrYesautoMessage UUID
versionstrYes"1.0"Protocol version
tsfloatYesautoTimestamp
episode_idstrYesEpisode identifier
step_idintYesStep number
action_idstrNoNoneTie to specific EnvAction
event_typestrYesObservation, tool_result, status, error
reasonstrNo""Reason: "proc_exit", "oom_warning", etc.
deltadict[str, Any]No{}Sparse diff (only changed fields)
rewardfloatNoNoneOptional reward signal
reward_infodictNo{}Additional reward metadata
terminalboolNoFalseMarks episode termination

State push use cases:

  • Async tool completion
  • External world changes (filesystem, browser DOM)
  • Long-running process updates
  • Safety/system signals (OOM, timeout)

Data Models

EnvState

Flexible state container with extra="allow" — accepts any fields the environment provides.

EnvObservation

FieldTypeRequiredDefaultDescription
episode_idstrYesEpisode this observation belongs to
step_numintYesStep number within episode
stateEnvStateYesEnvironment state
doneboolNoFalseEpisode is complete
truncatedboolNoFalseEpisode was truncated (time limit)
rewardfloatNo0.0Reward signal
created_atfloatNoautoObservation timestamp
metadatadict[str, Any]No{}Additional metadata

EnvAction

FieldTypeRequiredDefaultDescription
action_typestrYesAction type identifier
payloaddict[str, Any]No{}Action payload
metadatadict[str, Any]No{}Additional metadata

EnvEvent

FieldTypeRequiredDefaultDescription
event_idstrNoauto UUIDEvent identifier
typestrYesEvent type
episode_idstrYesEpisode context
step_idintYesStep context
action_idstrNoNoneTie to EnvAction
payloaddict[str, Any]No{}Event payload
timestampfloatNoautoEvent timestamp
metadatadict[str, Any]No{}Additional metadata

Error Codes — EnvErrorCode

CodeEnum ValueDescriptionRetryable
runtime_errorRUNTIME_ERRORGeneral runtime failureDepends
unknown_actionUNKNOWN_ACTIONAction type not recognizedNo
reset_deniedRESET_DENIEDEnvironment refused resetNo

Wire Examples

Reset and Step Loop

json
{"type":"env/reset/req","id":"er1","version":"1.0","ts":1716123456.789,"env_name":"browser","seed":42,"options":{"url":"https://example.com"}}
json
{"type":"env/reset/resp","id":"er2","version":"1.0","ts":1716123457.100,"req_id":"er1","obs":{"episode_id":"ep_abc","step_num":0,"state":{"url":"https://example.com","title":"Example"},"done":false,"truncated":false,"reward":0.0}}
json
{"type":"env/step/req","id":"es1","version":"1.0","ts":1716123458.100,"episode_id":"ep_abc","action":{"action_type":"click","payload":{"selector":"#button"}}}
json
{"type":"env/step/resp","id":"es2","version":"1.0","ts":1716123458.500,"req_id":"es1","obs":{"episode_id":"ep_abc","step_num":1,"state":{"url":"https://example.com/result","title":"Result"},"done":false,"truncated":false,"reward":1.0}}

State Push (Server-initiated)

json
{"type":"env/state/push","id":"sp1","version":"1.0","ts":1716123459.100,"episode_id":"ep_abc","step_id":1,"action_id":"act_1","event_type":"tool_result","reason":"proc_exit","delta":{"stdout":"done"},"reward":0.5,"terminal":false}

Security Considerations

  1. Episode isolation: Episodes must be scoped to prevent cross-session leakage
  2. Action validation: Actions must conform to action_space schema
  3. State push gating: Only emitted if agent negotiated env_push capability
  4. Batch limits: Host should enforce maximum batch_step size
  5. Reward signal integrity: Reward values must not be tamperable by the agent

A2E Protocol v1.0 — Released under the MIT License.