Your agent shouldn’t
make the same
mistake twice.
scope · flight-booking⊡ lesson
Retrace gives agents a memory of what worked, what failed, and what to try differently next time. A small layer between your agent and its next attempt.
$ pip install retracepython ≥ 3.10MITruns locally
LLMs can reason.
They can’t remember
what they learned.
An agent can spend twenty steps discovering why something failed, then make the exact same mistake tomorrow.
Most agent loops throw that experience away.
Retrace doesn’t.
3 runs · 3 failures · 0 lessons kept
2 runs · 1 failure · 1 lesson kept
One loop.
Nine stages.
Three of them are new.
Retrace sits beside your agent, not inside it. It watches a run end, decides whether anything worth keeping happened, and hands the result to the next run that needs it.
- [1]Your code owns the loop. Retrace observes a run; it never drives your agent.
- [2]Was the outcome acceptable? Heuristic, model-graded, or a verdict you supply.
- [3]The trace and verdict are condensed into a short, reusable lesson.
- [4]Only lessons that pass screening are kept. Memory is scoped per agent, task, or tenant.
- [5]On the next similar task, the most relevant lessons are returned as context.
- [6]You decide whether, when, and how many times to try again.
Turn execution outcomes into reusable lessons.
memory.reflect(task, result)Store useful experience in scoped, persistent memory.
memory.remember(lesson, scope="…")Inject relevant experience when the agent meets a similar situation again.
memory.retrieve(task, k=3)Attempt
fourteen.
Attempt fifteen.
A real session. The first run fails on a constraint the agent was never told to check. The reflection names the cause, writes a one-line lesson, and stores it. The next run on a similar task retrieves it before acting.
output abridged · ids shortened
user.max_flight_budget
A small layer in your stack.
A long memory for your agent.
- [ local / self-hosted ]
- Runs on your machine or inside your infrastructure. There is no hosted service in the loop.
- [ scoped memory ]
- Lessons live in a scope you define: an agent, a family of tasks, a tenant.
- [ isolation ]
- Scopes do not bleed into each other. One tenant's lessons are never retrieved for another.
- [ persistent store ]
- SQLite on disk by default. Swap in your own store through a small adapter interface.
- [ sdk / api ]
- A Python SDK and a plain HTTP API. Use whichever your agent already speaks.
- [ caller-controlled retry ]
- Retrace returns context. Your code decides whether, and how, to try again.
Intelligence without memory
is just repetition.
The useful part of an agent’s experience shouldn’t disappear when the context window closes.
Failures contain information.
Corrections contain information.
Successful strategies contain information.
Retrace turns that experience into infrastructure.
Give your
agent
a memory.
$ pip install retracefrom retrace import Retrace
memory = Retrace(scope="flight-booking")
for attempt in range(3):
# past lessons, ranked by relevance
lessons = memory.retrieve(task)
result = agent.run(task, context=lessons)
# evaluate → reflect → store if useful
memory.reflect(task, result)
if result.ok: breakThe loop is yours. Retrace only adds the two calls.
Private beta.
Two keys.
Seven steps.
Retrace ships as a private Python SDK and connects to a hosted API. Early users get two credentials, and it’s worth being clear about which one does what before you start.
Ten minutes from an empty folder to a running demo.
Unlocks the private package index so pip can download the SDK. It never touches the Retrace API.
<ENTITLEMENT_TOKEN>Starts with rt_live_. Authenticates the SDK and CLI to the hosted Retrace API. It is not used by pip.
<YOUR_RETRACE_API_KEY>- [1]
Request early access
Tell us a little about the agent you’re building. Request access →
- [2]
Receive two credentials
We’ll send a Cloudsmith install token and a Retrace API key. They do different jobs: one installs the SDK, the other talks to the API. Keep both out of version control.
- [3]
Create a virtual environment
Python 3.10 or newer. Any venv tool works; this is the plain one.
$ python -m venv .venv && source .venv/bin/activateWindows:
.venv\Scripts\activate - [4]
Install the private SDK
Replace
<ENTITLEMENT_TOKEN>with your Cloudsmith token. The extra index keeps public dependencies coming from PyPI.$ pip install retrace-agent --index-url https://dl.cloudsmith.io/<ENTITLEMENT_TOKEN>/zenvex/retrace/python/simple/ --extra-index-url https://pypi.org/simple - [5]
Log in to the hosted API
Paste
<YOUR_RETRACE_API_KEY>when prompted. The key is stored locally for the SDK and CLI to use.$ retrace login --base-url https://retrace-nsbhhri2ta-el.a.run.app - [6]
Verify the connection
Checks your Python version, the installed SDK, and that your key is accepted by the API.
$ retrace doctor --base-url https://retrace-nsbhhri2ta-el.a.run.app - [7]
Run the demo
One agent, one task, a few attempts. Watch it fail, reflect, remember, and retry.
$ retrace demo --base-url https://retrace-nsbhhri2ta-el.a.run.app
Hosted API: https://retrace-nsbhhri2ta-el.a.run.app
If retrace doctor reports a 401, you pasted the Cloudsmith token where the rt_live_ key should go. Run retrace login again.