ARE
Environment wrapper for Meta's Agent Research Environments (ARE).
Installation
pip install maseval[are]
Alternatively, install ARE directly:
pip install meta-agents-research-environments
API Reference
AREEnvironment
Bases: Environment
Generic maseval Environment wrapping ARE's simulation infrastructure.
Two construction paths:
- From a Scenario:
AREEnvironment.from_scenario(scenario) - From apps:
AREEnvironment.from_apps(apps=[...], duration=60, seed=42)
Both paths also accept run_oracle, notification_verbosity,
filter_aui_tools, and callbacks.
The raw AREEnvironment(environment_data=...) constructor is available
for subclasses that need full control over setup_state().
Lifecycle is user-controlled: call start() before run_agents(),
stop() after. pause()/resume_with_offset() control simulation time.
__init__
__init__(
environment_data: Dict[str, Any],
callbacks: Optional[List[EnvironmentCallback]] = None,
run_oracle: bool = False,
notification_verbosity: str = "medium",
filter_aui_tools: bool = False,
)
Initialize AREEnvironment.
| PARAMETER | DESCRIPTION |
|---|---|
environment_data
|
Dict. Must contain either:
-
TYPE:
|
callbacks
|
Optional maseval EnvironmentCallbacks.
TYPE:
|
run_oracle
|
If True, run ARE oracle mode during setup to generate expected event log. Stored in traces for evaluation.
TYPE:
|
notification_verbosity
|
ARE notification verbosity level.
TYPE:
|
cleanup
cleanup() -> None
Stop ARE simulation. Called by maseval after task completes.
create_tools
create_tools() -> Dict[str, AREToolWrapper]
Wrap all ARE app tools in AREToolWrapper.
| RETURNS | DESCRIPTION |
|---|---|
Dict[str, AREToolWrapper]
|
Dict mapping tool names to AREToolWrapper instances. |
from_apps
classmethod
from_apps(
apps: List[Any],
duration: int,
seed: int,
events: Optional[List[Any]] = None,
start_time: float = 0,
time_increment_in_seconds: int = 1,
scenario_id: str = "custom",
callbacks: Optional[List[EnvironmentCallback]] = None,
run_oracle: bool = False,
notification_verbosity: str = "medium",
filter_aui_tools: bool = False,
) -> AREEnvironment
Create AREEnvironment from ARE app instances and explicit config.
| PARAMETER | DESCRIPTION |
|---|---|
apps
|
List of ARE App instances (e.g.
TYPE:
|
duration
|
Scenario duration in seconds. Required — no default.
TYPE:
|
seed
|
Random seed for reproducibility. Required — no default.
TYPE:
|
events
|
Optional list of ARE events to schedule.
TYPE:
|
start_time
|
Simulation start time in seconds.
TYPE:
|
time_increment_in_seconds
|
Fixed tick interval (>= 1 second).
TYPE:
|
scenario_id
|
Identifier for the scenario.
TYPE:
|
callbacks
|
Optional maseval EnvironmentCallbacks.
TYPE:
|
run_oracle
|
If True, run ARE oracle mode during setup.
TYPE:
|
notification_verbosity
|
TYPE:
|
filter_aui_tools
|
If True, exclude AUI message-retrieval tools.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
AREEnvironment
|
Configured AREEnvironment instance. |
from_scenario
classmethod
from_scenario(
scenario: Any,
callbacks: Optional[List[EnvironmentCallback]] = None,
run_oracle: bool = False,
notification_verbosity: str = "medium",
filter_aui_tools: bool = False,
) -> AREEnvironment
Create AREEnvironment from a pre-built ARE Scenario.
| PARAMETER | DESCRIPTION |
|---|---|
scenario
|
ARE Scenario object (from
TYPE:
|
callbacks
|
Optional maseval EnvironmentCallbacks.
TYPE:
|
run_oracle
|
If True, run ARE oracle mode during setup.
TYPE:
|
notification_verbosity
|
TYPE:
|
filter_aui_tools
|
If True, exclude AUI message-retrieval tools.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
AREEnvironment
|
Configured AREEnvironment instance. |
gather_config
gather_config() -> Dict[str, Any]
Gather environment configuration for reproducibility.
gather_traces
gather_traces() -> Dict[str, Any]
Collect traces from environment and all tools.
get_are_environment
get_are_environment() -> Optional[Environment]
Get the underlying ARE Environment instance.
get_notification_system
get_notification_system() -> Optional[
VerboseNotificationSystem
]
Get the ARE notification system.
get_oracle_traces
get_oracle_traces() -> Optional[Dict[str, Any]]
Get oracle event log if oracle mode was enabled.
| RETURNS | DESCRIPTION |
|---|---|
Optional[Dict[str, Any]]
|
Oracle traces dict, or None if oracle was not run. |
get_scenario
get_scenario() -> Optional[Scenario]
Get the ARE scenario object.
get_simulation_time
get_simulation_time() -> float
Get current simulation time in seconds since scenario start.
get_start_time
get_start_time() -> Optional[float]
Get the scenario start time.
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.
get_turn_notifications
get_turn_notifications() -> Tuple[List[str], bool, bool]
Drain pending notifications, re-queuing environment notifications.
Like poll_notifications but instead of formatting environment
notifications into strings, it re-queues them back onto the message
queue so they remain available for later processing, and returns
boolean flags indicating their presence.
| RETURNS | DESCRIPTION |
|---|---|
List[str]
|
Tuple of |
bool
|
|
bool
|
|
Tuple[List[str], bool, bool]
|
|
pause
pause() -> None
Pause simulation time progression.
| RAISES | DESCRIPTION |
|---|---|
RuntimeError
|
If the ARE environment is not initialized. |
poll_notifications
poll_notifications() -> Tuple[List[str], List[str], bool]
Drain pending notifications from ARE's notification queue.
| RETURNS | DESCRIPTION |
|---|---|
List[str]
|
Tuple of |
List[str]
|
|
bool
|
|
Tuple[List[str], List[str], bool]
|
|
Agent adapters should call this between agent steps and inject the messages into the agent's context.
resume_with_offset
resume_with_offset(offset: float) -> None
Resume simulation with a time offset.
| PARAMETER | DESCRIPTION |
|---|---|
offset
|
Seconds to advance simulation clock before resuming.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
RuntimeError
|
If the ARE environment is not initialized. |
setup_state
setup_state(
environment_data: Dict[str, Any],
) -> Dict[str, Any]
Initialize ARE environment from environment data.
| PARAMETER | DESCRIPTION |
|---|---|
environment_data
|
Dict with
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Dict[str, Any]
|
State dict with scenario metadata. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If environment_data contains neither |
start
start() -> None
Start the ARE simulation event loop.
| RAISES | DESCRIPTION |
|---|---|
RuntimeError
|
If the ARE environment is not initialized. |
stop
stop() -> None
Stop the ARE simulation event loop.
| RAISES | DESCRIPTION |
|---|---|
RuntimeError
|
If the ARE environment is not initialized. |
AREToolWrapper
Bases: TraceableMixin, ConfigurableMixin
Framework-agnostic wrapper for ARE tools with maseval tracing.
Wraps an ARE Tool and exposes its metadata (name, description, inputs, output_type) so that agent adapters can construct framework-native tools.
Example for smolagents::
class MySmolagentsTool(smolagents.Tool):
skip_forward_signature_validation = True
def __init__(self, wrapper: AREToolWrapper):
self.wrapper = wrapper
self.name = wrapper.name
self.description = wrapper.description
self.inputs = wrapper.inputs
self.output_type = wrapper.output_type
super().__init__()
def forward(self, **kwargs) -> str:
return self.wrapper(**kwargs)
__call__
__call__(**kwargs: Any) -> Any
Execute the ARE tool with tracing.
| PARAMETER | DESCRIPTION |
|---|---|
**kwargs
|
Tool arguments matching the inputs schema.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Any
|
Tool output (type varies per tool). |
__init__
__init__(are_tool: Any, environment: AREEnvironment)
Initialize the tool wrapper.
| PARAMETER | DESCRIPTION |
|---|---|
are_tool
|
ARE Tool instance to wrap.
TYPE:
|
environment
|
The AREEnvironment this tool belongs to.
TYPE:
|
gather_config
gather_config() -> Dict[str, Any]
Gather configuration from this tool.
| RETURNS | DESCRIPTION |
|---|---|
Dict[str, Any]
|
Dictionary with tool name, description, and schema. |
gather_traces
gather_traces() -> Dict[str, Any]
Gather execution traces from this tool.
| RETURNS | DESCRIPTION |
|---|---|
Dict[str, Any]
|
Dictionary with tool name, invocation history, and counts. |