Standardizing environment infrastructure with Strands Agents — step, observe, reward.
Project description
strands-env
Standardizing environment infrastructure with Strands Agents — step, observe, reward.
Features
This package treats each env.step() as a full agent loop (prompt → (tool_call, tool_response)* → response), not a single model call.
- Define Environments — Subclass
Environment, add@toolfunctions, plug inRewardFunction - RL Training — Token-level observations for on-policy training with strands-sglang
- Benchmarking — CLI and
Evaluatorwith checkpointing, resume, and custom metrics
Install
pip install strands-env
For development:
git clone https://github.com/horizon-rl/strands-env.git && cd strands-env
pip install -e ".[dev]"
Quick Start
Define an Environment
Subclass Environment and add tools as @tool-decorated functions:
from strands import tool
from strands_env.core import Environment
@tool
def calculator(expression: str) -> str:
"""Evaluate a math expression."""
return str(eval(expression))
class MathEnv(Environment):
def get_tools(self):
return [calculator]
Run It
env = MathEnv(model_factory=factory, reward_fn=reward_fn)
result = await env.step(Action(message="What is 2^10?", task_context=TaskContext(ground_truth="1024")))
result.observation.final_response # "The answer is 1024"
result.reward.reward # 1.0
result.termination_reason # TerminationReason.TASK_COMPLETE
See examples/calculator_demo.py for a complete example.
Run Evaluations
strands-env eval aime-2024 \
--env examples.eval.simple_math.calculator_env \
--backend sglang \
--base-url http://localhost:30000 \
--n-samples-per-prompt 8 \
--max-concurrency 30
Tip: For a non-agentic benchmark (no tool use), simply don't override
get_tools()in your environment — the base class returns[]by default.
Built-in Environments
Ready-to-use environments under src/strands_env/environments/. Each ships with its own README, system prompt, and requirements.txt.
| Environment | Description |
|---|---|
calculator |
Simple environment with a calculator tool for math reasoning. |
code_sandbox |
Sandboxed Python / shell execution via AWS Bedrock AgentCore Code Interpreter. |
web_search |
Pluggable search (Serper / Google CSE) + Jina-based page scraping with optional LLM summarization, enlightened by OpenSeeker. |
terminal_bench |
Run Terminal-Bench tasks against a Harbor-managed Docker/EKS container. |
swe_bench |
SWE-bench task runner — thin subclass of terminal_bench with a SWE-bench-tuned system prompt. |
mcp_atlas |
MCP-Atlas benchmark runner across 36 MCP servers with 500 tasks. |
agent_world_model |
AgentWorldModel tasks with 1000 synthetic FastAPI + SQLite environments exposed as MCP tools. |
Documentation
- Evaluation Guide — CLI reference, hook files, custom evaluators
- RL Training Integration — slime integration, token observations
Development
# Lint
ruff check src/ && ruff format --check src/
# Unit tests
pytest tests/unit/ -v
# Integration tests (requires running SGLang server)
pytest tests/integration/ -v --sglang-base-url=http://localhost:30000
Or if using Claude Code, just use /run-unit-tests and /run-integration-tests slash commands.
License
Apache License 2.0 — see LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file strands_env-0.3.2.tar.gz.
File metadata
- Download URL: strands_env-0.3.2.tar.gz
- Upload date:
- Size: 131.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
05c38cfe4d9680a570ea0570dfa4ba6dadb62f18625d1ce215b79990234bf902
|
|
| MD5 |
38bbf6341cb64c33bd64387ebb409fd5
|
|
| BLAKE2b-256 |
db1741176782b65283541bafc4d833fc60b9fbb91421dd2a6310d27934746f21
|
Provenance
The following attestation bundles were made for strands_env-0.3.2.tar.gz:
Publisher:
publish.yml on strands-rl/strands-env
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
strands_env-0.3.2.tar.gz -
Subject digest:
05c38cfe4d9680a570ea0570dfa4ba6dadb62f18625d1ce215b79990234bf902 - Sigstore transparency entry: 1430726185
- Sigstore integration time:
-
Permalink:
strands-rl/strands-env@056483cfd0e2bfb3c0098c3a041cb4db9c32937c -
Branch / Tag:
refs/tags/v0.3.2 - Owner: https://github.com/strands-rl
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@056483cfd0e2bfb3c0098c3a041cb4db9c32937c -
Trigger Event:
release
-
Statement type:
File details
Details for the file strands_env-0.3.2-py3-none-any.whl.
File metadata
- Download URL: strands_env-0.3.2-py3-none-any.whl
- Upload date:
- Size: 133.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2b748caee11155cd0deb963e9d9a83b5818bab89091367cf62433578a11439df
|
|
| MD5 |
722f0f6e7636732c2ff231d7ec94cef7
|
|
| BLAKE2b-256 |
b5bdf4d157bf39b34a7e8aeab436de5943383b48f494397f327e8d5eadaf88ca
|
Provenance
The following attestation bundles were made for strands_env-0.3.2-py3-none-any.whl:
Publisher:
publish.yml on strands-rl/strands-env
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
strands_env-0.3.2-py3-none-any.whl -
Subject digest:
2b748caee11155cd0deb963e9d9a83b5818bab89091367cf62433578a11439df - Sigstore transparency entry: 1430726291
- Sigstore integration time:
-
Permalink:
strands-rl/strands-env@056483cfd0e2bfb3c0098c3a041cb4db9c32937c -
Branch / Tag:
refs/tags/v0.3.2 - Owner: https://github.com/strands-rl
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@056483cfd0e2bfb3c0098c3a041cb4db9c32937c -
Trigger Event:
release
-
Statement type: