Metadata-Version: 2.4
Name: agent-safety-bench-envs
Version: 0.1.0
Summary: Tool environments for the Agent Safety Bench (ASB) benchmark
Author-email: Aradhye Agarwal <aradhyeagarwal@gmail.com>
License: Apache-2.0
Project-URL: Homepage, https://github.com/aradhyeagarwal/asb-envs
Project-URL: Issues, https://github.com/aradhyeagarwal/asb-envs/issues
Keywords: llm,agent,safety,benchmark,tools
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
License-File: NOTICE
Requires-Dist: pydantic>=2.0
Requires-Dist: docstring_parser>=0.15
Requires-Dist: typing_extensions>=4.0
Dynamic: license-file

# agent-safety-bench-envs

Tool environments for the **Agent Safety Bench (ASB)** benchmark. Each environment
exposes a small set of mock tools (Python callables described by JSON schemas) that
an LLM agent can call. ASB pairs these environments with prompts to evaluate agent
safety under prompt-injection and other adversarial conditions.

The companion prompt dataset lives on the Hugging Face Hub:
[`aradhye/asb`](https://huggingface.co/datasets/aradhye/asb).

## Install

```bash
pip install agent-safety-bench-envs
```

## Quickstart

```python
from asb_envs import EnvManager

mgr = EnvManager()
env = mgr.init_env("AccessControl_1", env_params=None)

print(env.tool_list)
print(env.get_tool_descs(["list_access_attempts"]))

result = env.call_tool("list_access_attempts", {})
print(result)
```

`init_env(name, env_params)` dynamically imports the env class and instantiates it.
Each env is a subclass of `BaseEnv` whose tools are auto-validated against the
`{ClassName}.json` schema shipped with the package.

## Schema

Every env class has a sibling JSON file declaring its tools:

```json
[
  {
    "name": "tool_name",
    "description": "...",
    "parameters": {
      "type": "object",
      "properties": { "...": { "type": "string" } },
      "required": ["..."]
    }
  }
]
```

`BaseEnv.call_tool(name, args)` validates required params, coerces basic types, and
dispatches to the matching method on the env class.

## Citation

If you use these environments, please cite the ASB paper (ICML 2026):

```bibtex
@inproceedings{asb2026,
  title={...},
  author={...},
  booktitle={ICML},
  year={2026}
}
```

## License

Apache 2.0. The vendored `functions_runtime.py` is from
[agentdojo](https://github.com/ethz-spylab/agentdojo) and is MIT-licensed —
see `NOTICE`.
