ACE Context Learning Engine
Turns agent feedback and execution traces into reusable strategies.
What does this agent do, and when should you use it?
Agentic Context Engine (ACE) is an open-source Python engine for adding a persistent learning loop to AI agents. It stores strategies in a persistent Skillbook and divides work among an Agent, Reflector, and SkillManager for execution, trace analysis, and strategy curation. Its Recursive Reflector writes and runs Python in a sandboxed environment to search traces for patterns, isolate errors, and derive actionable insights. The repository offers ACELiteLLM, ACE, TraceAnalyser, BrowserUse, LangChain, and ClaudeCode runners, plus a composable pipeline system. It can be used as a library in a Python project and exposes ace, kayba, and ace-mcp commands; Kayba is the managed service powered by the engine.
With ACELiteLLM, an application calls .ask() to invoke a model, then passes a correction to .learn_from_feedback(); ACE extracts a strategy, updates the Skillbook, and makes the strategy available to later .ask() calls. For existing logs, agent.learn_from_traces(your_existing_traces) provides a path to learn from recorded traces without rerunning tasks. A full learning flow can combine AgentStep, EvaluateStep, ReflectStep, UpdateStep, and DeduplicateStep, or use learning_tail() for the standard tail sequence. The environment sends a trace to the Reflector; the Recursive Reflector executes Python analysis in a sandbox, and the SkillManager adds, refines, or removes Skillbook strategies. The CLI supports ace setup for model and key configuration, ace models for model and pricing search, ace validate for connection testing, and kayba for trace upload, insight retrieval, and prompt management.
- A Python developer whose question-answering or tool-using agent receives human corrections and needs those corrections to influence later requests.
- A team with historical agent logs that wants to extract reusable strategies through learn_from_traces() instead of rerunning the original tasks.
- A developer using browser-use for browser automation who wants repeated runs to improve through accumulated strategies.
- A team already operating a LangChain chain or agent that wants to add a learning loop through the LangChain runner.
- An engineering team running Claude Code CLI tasks that wants to apply the learning loop through the ClaudeCode runner.
What are this agent's strengths and limitations?
- Uses a persistent Skillbook with distinct Agent, Reflector, and SkillManager roles instead of limiting learning to a single-session summary.
- The Recursive Reflector writes and executes sandboxed Python to inspect traces, which is suited to finding patterns and errors in complex execution records.
- Covers a lightweight ACELiteLLM path, batch-epoch ACE runs, historical-trace learning, and runners for browser-use, LangChain, and Claude Code.
- Its pipeline uses requires/provides contracts, immutable context, and error isolation, with either learning_tail() or custom step composition.
- Setup requires provider credentials and connection validation; operation depends on network access and an external LLM provider.
- The learning loop executes Python generated by the Recursive Reflector; although it is sandboxed, adopters need to assess whether this execution model fits their runtime governance.
- The reported benchmark gains have stated models, tasks, and learning conditions, and the supplied material does not establish that they generalize to every agent, model, or business task.
- The supplied material does not specify supported Python versions, the Skillbook storage implementation, or full self-hosted deployment operations.
How do you install or deploy this agent?
You need Python, uv, and an API key for a supported model provider. Install with:
uv add ace-framework
For guided configuration:
ace setup
Or set credentials manually; for OpenAI:
export OPENAI_API_KEY="your-key"
Install integration extras as needed:
uv add 'ace-framework[browser-use]'
uv add 'ace-framework[langchain]'
uv add 'ace-framework[mcp]'
How do you use this agent?
After running ace setup or setting an API key, a minimal learning flow is:
from ace import ACELiteLLM
agent = ACELiteLLM(model="gpt-4o-mini")
answer = agent.ask("Is there a seahorse emoji?")
agent.learn_from_feedback("There is no seahorse emoji in Unicode.")
answer = agent.ask("Is there a seahorse emoji?")
print(agent.get_strategies())
Use ace validate <model> to test a model connection, or ace models <query> to search available models and pricing.