Environment
Environments define the execution context for agents, including available tools, state, and any external resources needed during task execution.
Environment
Bases: ABC, TraceableMixin, ConfigurableMixin
Manages the state and tools available during a task execution.
Subclasses must implement: - setup_state(task_data) -> Any: Initialize environment state from task data - create_tools() -> Dict[str, Any]: Create tools keyed by name
create_tools
abstractmethod
create_tools() -> Dict[str, Any]
Creates tools that can interact with the environment's state.
| RETURNS | DESCRIPTION |
|---|---|
Dict[str, Any]
|
Dict mapping tool names to tool instances |
gather_config
gather_config() -> dict[str, Any]
Gather configuration from this environment.
Output fields:
type- Component class namegathered_at- ISO timestamptool_count- Number of toolstool_names- List of tool names
| RETURNS | DESCRIPTION |
|---|---|
dict[str, Any]
|
Dictionary containing environment configuration. |
gather_traces
gather_traces() -> dict[str, Any]
Gather execution traces from this environment and its tools.
Output fields:
type- Component class namegathered_at- ISO timestamptool_count- Number of tools in environmenttools- Dictionary of tool traces keyed by tool name
| RETURNS | DESCRIPTION |
|---|---|
dict[str, Any]
|
Dictionary containing environment execution traces. |
get_tool
get_tool(name: str) -> Optional[Any]
Get a tool by name.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
Tool name
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Optional[Any]
|
The tool, or None if not found |
get_tools
get_tools() -> Dict[str, Any]
Get all tools as a dict.
setup_state
abstractmethod
setup_state(task_data: dict) -> Any
Initializes the environment's state from task data.
Tools and agent-provided helpers
Some agent adapters expose helper tools or user-simulation tools that can be used by the Environment. See the framework-specific interface pages for details:
- SmolAgents —
SmolAgentAdapter,SmolAgentLLMUser - LangGraph —
LangGraphAgentAdapter - LlamaIndex —
LlamaIndexAgentAdapter