Skip to content
AgentEnv Framework

The Environment Card

An Open Protocol for Environments

The Open Protocol for Using RL Environments

Every environment describes itself in a small JSON document, its environment card, served at /.well-known/agent-env.json. The card says which tools an environment has, how its state is reset, loaded and read, and which extensions it supports, so the framework can drive any environment that serves one without code written for it.

What's on the card

AgentEnvEnvironment builds the card from your class, so you rarely write one by hand:

On the cardFrom the class
nameENVIRONMENT_NAME, then @environment_card(name=...), then the class name
url, preferredTransportthe data plane, JSON-RPC at /agentenv
additionalInterfacesthe MCP endpoint, /mcp, where agents call the tools
capabilities.toolseach @tool method, with its docstring and input schema
capabilities.operations@reset_data, @add_data and @get_data, as data/reset, data/add and data/get
capabilities.extensionseach @extension method, with its URN and the route that serves it
children_environmentsthe servers' cards, when the environment is composed

Every deploy passes the name the env was registered with in ENVIRONMENT_NAME, so the card, the stored env and the tool prefixes agree.

Extensions

An extension is a URN on the card with the route and methods that serve it, such as urn:agentenv:set-errors/v1 for forced errors. The framework looks one up by URN and method before calling it: a step that needs one the card doesn't list stops before sending anything, or skips that environment when it's told to tolerate the gap.

The urn:agentenv: extensions are the ones the framework's own steps call. Any other URN works too, for extensions your own tasks call.

Env Topology Extensions

An env's topology can provide extensions out of the box, on top of the ones your class implements. The gateway topology, the default, puts the gateway's own card in front of your server's, with per-role tool access, triggers and a virtual clock already on it; the server topology serves your server's card alone.

Get an Env Instance's Card

A deploy stores the instance's card on its record, which outlives the instance:

Python
import json

from agent_env.env import get_env_instance_store

record = get_env_instance_store().get("email-mmtflq6t")
print(json.dumps(record.environment_card, indent=2))

From then on, task steps find what they need on that stored copy, and a few, such as the card validator, fetch a fresh one.

Last updated on

Ask a question · Report an issue