File size: 3,891 Bytes
116524e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# Quick Start

Get a self-learning agent running in under a minute.

## Simplest Example

If you've run `ace setup` (see [Setup](setup.md)), you can load your config automatically:

```python

from ace import ACELiteLLM



agent = ACELiteLLM.from_setup()



# Ask related questions — the agent learns patterns across them

answer1 = agent.ask("If all cats are animals, is Felix (a cat) an animal?")

answer2 = agent.ask("If all birds fly, can penguins (birds) fly?")



print(f"Learned {len(agent.skillbook.skills())} strategies")



# Save and reload later

agent.save("my_agent.json")

```

Or specify a model directly (API key must be in the environment):

```python

agent = ACELiteLLM.from_model("gpt-4o-mini")

```

## Choose Your Integration

=== "LiteLLM"

    The simplest path. Supports 100+ LLM providers.


    ```python

    from ace import ACELiteLLM


    agent = ACELiteLLM.from_model("gpt-4o-mini")

    answer = agent.ask("Your question")

    agent.save("learned.json")

    ```


=== "LangChain"

    Wrap any LangChain Runnable (chains, agents, graphs) with learning.


    ```python

    from ace import LangChain


    runner = LangChain.from_model(your_chain, ace_model="gpt-4o-mini")

    results = runner.run([{"input": "Your task"}])

    runner.save("chain_expert.json")

    ```


=== "Browser-Use"

    Browser automation that learns navigation patterns.


    ```python

    from ace import BrowserUse

    from langchain_openai import ChatOpenAI


    runner = BrowserUse.from_model(

        browser_llm=ChatOpenAI(model="gpt-4o"),

        ace_model="gpt-4o-mini",

    )

    results = runner.run("Find the top post on Hacker News")

    runner.save("browser_expert.json")

    ```


=== "Claude Code"

    Self-improving coding agent using the Claude Code CLI.


    ```python

    from ace import ClaudeCode


    runner = ClaudeCode.from_model(working_dir="./my_project")

    results = runner.run("Add unit tests for utils.py")

    runner.save("coding_expert.json")

    ```


## Full Pipeline Example

For full control, use the three ACE roles directly:

```python

from ace import (

    ACE, Agent, Reflector, SkillManager,

    Sample, SimpleEnvironment,

)



# Create roles (each takes a model string directly)

agent = Agent("gpt-4o-mini")

reflector = Reflector("gpt-4o-mini")

skill_manager = SkillManager("gpt-4o-mini")



# Build the adaptive pipeline

runner = ACE.from_roles(

    agent=agent,

    reflector=reflector,

    skill_manager=skill_manager,

    environment=SimpleEnvironment(),

)



# Train on samples

samples = [

    Sample(question="What is the capital of France?", context="", ground_truth="Paris"),

    Sample(question="What is 2 + 2?", context="", ground_truth="4"),

]



results = runner.run(samples, epochs=2)

print(f"Learned {len(runner.skillbook.skills())} strategies")

runner.save("trained.json")

```

## Loading Saved Agents

```python

from ace import ACELiteLLM



# Resume from a saved skillbook

agent = ACELiteLLM.from_model("gpt-4o-mini", skillbook_path="my_agent.json")

answer = agent.ask("New question")  # Uses previously learned strategies

```

## Trying Different Models

```python

from ace import ACELiteLLM



# OpenAI

agent = ACELiteLLM.from_model("gpt-4o-mini")



# Anthropic

agent = ACELiteLLM.from_model("claude-sonnet-4-5-20250929")



# Google

agent = ACELiteLLM.from_model("gemini-pro")



# Local (Ollama)

agent = ACELiteLLM.from_model("ollama/llama2")

```

## What to Read Next

- [How ACE Works](../concepts/overview.md) — understand the three-role architecture
- [The Skillbook](../concepts/skillbook.md) — how strategies are stored and evolve
- [Full Pipeline Guide](../guides/full-pipeline.md) — build custom ACE pipelines
- [Integrations](../integrations/index.md) — LangChain, Browser-Use, Claude Code