fhaviary
Gymnasium framework for training language model agents on constructive tasks
What it is and what it does
This package provides a gymnasium-style framework for building custom reinforcement learning environments where language model agents solve tasks by making tool calls and exchanging messages. It defines core abstractions—Environment, Message, Tool, and ToolRequestMessage—that handle agent-environment communication following OpenAI's message standard. The library ships with pre-built environments for math, general knowledge, biological sequences, scientific literature, and protein stability tasks, plus a Jupyter notebook environment.
The core workflow involves subclassing Environment to define custom tasks, implementing reset() to initialize state and tools, and step() to execute agent actions and return observations and rewards. Communication flows through a message formalism where agents emit ToolRequestMessage objects containing tool calls, and the environment responds with ToolResponseMessage objects or general observations. The framework is designed to integrate with a sister library for defining agents as Language Decision Processes, though it remains task-agnostic and works with any agent implementation.
Use it for:
- Train language agents on math reasoning tasks by defining environments with calculator tools and evaluating agent trajectories
- Build custom multi-step reasoning environments where agents call domain-specific tools to solve problems
- Evaluate language model performance on knowledge retrieval by wrapping datasets as environments with tool-based interaction
- Research agent behavior on scientific tasks like protein stability prediction or sequence analysis
- Run Jupyter notebooks as interactive environments where agents execute code and observe outputs
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
A gymnasium framework for defining custom reinforcement learning environments where language model agents interact via tool calls and messages to solve structured tasks.
Yes, if you are building or evaluating language agent systems on structured tasks. The framework is actively maintained, has no known vulnerabilities, uses permissive licensing, and provides a clean abstraction for agent-environment interaction. Best suited for researchers and developers working with language model agents; less relevant if you only need a standard RL gym or don't plan to define custom environments.
Install
fhaviary on PyPI
pip
pip install fhaviaryuv
uv add fhaviarypoetry
poetry add fhaviaryInstalling fhaviary
Before you install
Low install friction with a pure-Python wheel distribution. Actively maintained with recent commits. Supports Python 3.11 through 3.14 with 5 runtime dependencies including httpx and pydantic.
License in practice
Apache License 2.0 is permissive and allows commercial use, modification, and distribution with minimal restrictions. You must include a copy of the license and note any changes to the source.
Quickstart
pip install fhaviary
from aviary.core import Environment, Message, ToolRequestMessage, Tool
class CounterEnv(Environment):
async def reset(self):
self.state = {"count": 0}
self.tools = [Tool.from_function(self.increment)]
return [Message(content="Start counting")], self.tools
async def step(self, action: ToolRequestMessage):
obs = await self.exec_tool_calls(action)
return obs, 0, False, False
def increment(self):
self.state["count"] += 1
return f"count={self.state['count']}"
Requires Python 3.11 or later. A custom agent implementation or integration with an external agent library is needed to run agents on the environment; this package defines the environment interface only.
Verify before relying
- Whether pre-built environments (GSM8K, HotPotQA, LabBench, LFRQA, Notebook) are included in base install or require optional extras
- Whether the sister library LDP is required to use Aviary or optional for advanced workflows
- Performance characteristics and scalability limits for agent training at scale
Package facts
| License | Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for… (full text in the JSON record) (permissive) |
| Python support | supports the current Python release (>=3.11) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 5 — docstring_parser, httpx, httpx-aiohttp, pydantic-core, pydantic |
| Maintenance | actively maintained — 120 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 106,011/month — #12,673 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: fhaviary-0.35.0-py3-none-any.whl
Tags
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to…
permissive · top 100 on PyPI
huggingface-hubClient library and CLI tool for downloading,…
permissive · top 100 on PyPI
langchainLangChain provides a framework for building…
permissive · top 1,000 on PyPI
hf-xethf-xet provides chunk-based deduplication and…
permissive · top 1,000 on PyPI
tokenizersTokenizers converts raw text into token…
permissive · top 1,000 on PyPI
transformersTransformers provides a unified framework for…
permissive · top 1,000 on PyPI
gymnasiumGymnasium provides a standard Python API for…
permissive · top 5,000 on PyPI
nemo-gymNeMo Gym provides infrastructure for building,…
permissive · top 5,000 on PyPI
gem-llmGEM is a reinforcement learning environment…
permissive · top 15,000 on PyPI
gym-alohaProvides a Gymnasium environment for the ALOHA…
permissive · top 15,000 on PyPI
pettingzooPettingZoo provides multi-agent reinforcement…
permissive · top 15,000 on PyPI
livekit-plugins-anthropicIntegrates Anthropic's Claude models into…
permissive · top 5,000 on PyPI
stable-baselines3Stable Baselines3 provides PyTorch…
permissive · top 5,000 on PyPI
kaggle-environmentsKaggle Environments provides a framework for…
unclear · top 15,000 on PyPI
openenv-coreOpenEnv provides a Gymnasium-style framework…
unclear · top 15,000 on PyPI
TextArenaTextArena provides a framework of 100+…
permissive · top 15,000 on PyPI