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 executes sandboxed Python directly in your process, bypassing JSON serialization to let complex objects flow freely. You define a safe, focused environment by whitelisting exactly which capabilities are available.
Key features:
- Type-Safe Execution: Agents fulfill typed signatures by executing sandboxed Python.
- Curated Scope: Whitelist exactly which modules and classes are available.
- Stateful Memory: Versioned workspace enables time-travel debugging.
- Multi-Agent Orchestration: Coordinate agents with natural Python control flow.
- Flexible Hosting: Run locally (default), on HTTP servers, or serverless via Modal.
This works because agex agents can accept and return complex types like pandas.DataFrame and plotly.Figure objects without intermediate JSON serialization. For a deeper dive, check out the full agex101.ipynb tutorial or see geospatial routing with OSMnx for advanced multi-library integration.
For a full demo app where agex integrates with NiceGUI, see agex-ui.
Complete documentation is hosted at ashenfad.github.io/agex.
Key sections:
Install agex with your preferred LLM provider:
# Install with a specific provider
pip install "agex[openai]" # For OpenAI models
pip install "agex[anthropic]" # For Anthropic Claude models
pip install "agex[gemini]" # For Google Gemini models
# Or install with all providers
pip install "agex[all-providers]"
⚠️ agexis 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.
We welcome contributions! See our Contributing Guide for details on our development workflow, code style, and how to submit pull requests. For bug reports and feature requests, please use GitHub Issues.
