Skip to content

agex: Library-Friendly Agents

agex (a portmanteau of agent execution) is a Python-native agentic framework that enables AI agents to work directly with your existing libraries and codebase.

agex demo gif

This works because agex agents can accept and return complex types like pandas.DataFrame and plotly.Figure objects without intermediate JSON serialization. Dive deeper with the full agex101.ipynb tutorial.

What Makes This Different

agex uses a subset of Python as the agent action space, executing actions in a sandboxed environment within your process. This approach avoids the complexity of JSON serialization and allows complex objects to flow directly between your code and the agent. You control exactly what functions, classes, and modules are available, creating a powerful yet secure environment.

  • Code-as-Action


    AST-based sandbox allows agents to take action through code but within limits.

  • Agent Workspace Persistence


    Agents & their compute environments persist w/ git-like versioning.

  • Library Integration


    Agents integrate with existing Python libraries (not restricted to tools).

  • Multi-Agent Orchestration


    Hierarchical agents or agent coordination via Python control flow.

  • Event Streams


    Observe agents in real-time with notebook-friendly event streaming.

  • Benchmarking


    Test & evaluate agent performance with data-driven metrics.

Get Started

Installation

Install agex with your preferred LLM provider:

pip install "agex[openai]"
pip install "agex[anthropic]"
pip install "agex[gemini]"
pip install "agex[all-providers]"

Project Status

Alpha

agex is a new framework in active development. While the core concepts are stabilizing, the API should be considered experimental and is subject to change.

For teams looking for a more battle-tested library built on the same "agents-that-think-in-code" philosophy, we highly recommend Hugging Face's excellent smolagents project. agex explores a different architectural path, focusing on deep runtime interoperability and a secure, sandboxed environment for direct integration with existing Python libraries.