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

  • 📚 Quick Start Guide


    Learn step-by-step with hands-on examples - from basic agents to multi-agent workflows.

  • 🔭 The Big Picture


    Understand the core philosophy and architectural principles behind agex.

  • Code Examples


    Explore advanced patterns and core concepts with runnable Python examples.

  • 📖 API Reference


    Complete technical documentation for all agex components and methods.

  • Demo App: agex-ui


    See an agent build a dynamic web UI on the fly with NiceGUI. A live example of agent-driven development.

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]"

Built On

agex is composed of several focused libraries that can also be used independently:

  • sandtrap — In-process Python sandbox via AST rewriting
  • kvgit — Versioned key-value store with git-like semantics
  • monkeyfs — Filesystem interception via monkey-patching
  • termish — Virtual terminal with shell-like commands
  • reprobate — Budget-controlled repr for Python objects

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.