Trace Generative Optimizer
Optimize agent prompts, code, and trainable parameters end to end using execution traces and general feedback.
- Source repo
- microsoft/Trace
- Stars
- ★ 767
- Last updated
- 1y ago v0.1.3.8
- FARS reviewed
- Nov 08, 2026
- License
- MIT
- Primary language
- Python
- FA score
- 51/100 · Major gaps
At a glance
- How it runs
- Works with
- Universal · cross-platformOpenAI API · Claude API
- Cost
- Free software; you pay for model usage
- Setup effort
- Medium · a few setup steps
- You'll need
- Typical use
- An agent engineering team has several prompts and Python processing stages and wants to optimize them jointly against end-to-end task feedback.
- Not a fit if
- Teams needing a stable production API; this is a research-purpose beta
- Teams that cannot send prompts and data to external LLM providers
- Website
- microsoft.github.io/Trace ↗ set on GitHub
- Maintenance
- No commits for 6+ monthslast commit 2025-08-14latest release v0.1.3.8 (2025-03-23)
- Source review
- 51/100 · Major gaps
What does this agent do, and when should you use it?
Trace is an AutoDiff-like Python library for training AI systems from numerical rewards, losses, natural-language critiques, compiler errors, and other feedback. Developers declare graph values with node, wrap optimizable Python functions with bundle, and can organize agents with model. During execution, Trace records relevant operations into a computation graph; OptoPrime, OPRO, or TextGrad then propagates feedback through that graph and updates trainable content. Its zero_feedback(), backward(), and step() workflow resembles PyTorch while extending optimization to prompts and executable Python functions. Trace runs as a local library and reaches model APIs through LiteLLM or a compatible AutoGen v0.2 backend; it is not a hosted agent service. The project is a research-oriented beta and is best suited to teams that can evaluate outputs and retain human oversight.
A developer marks mutable values with opto.trace.node(..., trainable=True), wraps optimizable functions in @bundle(trainable=True), or defines an agent class with @trace.model. Trace records operations on nodes and bundled functions to construct an execution graph; workflows can call models through trace.operators.call_llm and return ordinary values, while trace.ExecutionError exposes an exception node when execution fails. The application compares an output with its target and supplies text feedback, a reward, a loss, or an error signal. OptoPrime, OPRO, or TextGrad then applies zero_feedback(), backward(...), and step() to revise trainable nodes and functions. A call such as backward(..., visualize=True) can also render the computation graph.
- An agent engineering team has several prompts and Python processing stages and wants to optimize them jointly against end-to-end task feedback.
- A researcher wants to reproduce experiments or compare OptoPrime, OPRO, and TextGrad behind one computation-graph interface.
- An NLP engineer working on tasks such as BigBench-Hard needs one pipeline that optimizes prompts together with program logic.
- A multi-agent researcher is studying collaboration in VirtualHome and wants optimization signals derived from full execution traces.
- A robotics researcher wants to update robotic-arm control code after observing a complete interaction trajectory in an environment such as MetaWorld.
- A programming-systems researcher wants to use compiler errors, performance evaluations, or other general feedback to iteratively revise trainable functions.
Key setup facts
Pulled from the install and usage notes below. The project README has the current values.
- Install / run
pip install trace-optpip install trace-opt[autogen]pip install -e
- Environment variables
OPENAI_API_KEYANTHROPIC_API_KEYTRACE_LITELLM_MODEL- Runtime
- Python 3.9
How do you install or deploy this agent?
Python 3.9 or newer is required. Install the standard package with pip install trace-opt; LiteLLM is the default LLM backend. For the compatible AutoGen backend, run pip install trace-opt[autogen]. For development, clone the repository and run pip install -e . from its directory. Git Large File Storage may also be necessary if a normal clone fails.
How do you use this agent?
With LiteLLM, first provide a supported provider credential, such as export OPENAI_API_KEY="<key>" or export ANTHROPIC_API_KEY="<key>", and select a default model with export TRACE_LITELLM_MODEL='gpt-4o'. A minimal trace imports node with from opto.trace import node, creates x = node(1, trainable=True), performs ordinary Python operations, and calls z.backward("maximize z", visualize=True, print_limit=25). To optimize a function, decorate it with @bundle(trainable=True), construct optimizer = OptoPrime(function.parameters()), run the function and calculate feedback on each iteration, then call optimizer.zero_feedback(), optimizer.backward(result, feedback), and optimizer.step(). To change backends, set TRACE_DEFAULT_LLM_BACKEND to LiteLLM or AutoGen before importing opto; AutoGen can read model and API-key entries from an OAI_CONFIG_LIST file in the working directory or from the environment variable of the same name.
Safety boundaries, hardening & integrations
Operational blast radius, source-verified safety controls, and first-run hardening steps before connecting this agent to real workspaces.
Declared capability surface (blast radius)
Can run terminal commands; pair with approval gates or container/OS sandboxing.
Modifies local files; work on a clean Git branch or dedicated worktree.
Makes outbound requests; verify telemetry settings and model data routing on private repos.
FARS trust-control audit
- verifiable attribution
What are this agent's strengths and limitations?
- It can optimize executable Python functions as well as string prompts, allowing both to participate in one computation graph.
- It accepts numerical rewards, losses, natural-language feedback, and compiler errors rather than requiring a conventionally differentiable loss.
- The node, backward, and optimizer APIs follow a familiar PyTorch-like workflow and include built-in computation-graph visualization.
- OptoPrime, OPRO, and TextGrad can be swapped within the same framework; the documentation reports OptoPrime as roughly two to three times faster than TextGrad.
- LiteLLM and AutoGen v0.2 paths cover documented OpenAI and Anthropic configurations, while tutorials span agents, NLP, multi-agent collaboration, and robotics.
- The repository explicitly describes the library as a research-purpose beta whose features and behavior may change.
- Optimization depends on networked LLM APIs and valid credentials, introducing provider charges and sensitivity to model availability and behavior.
- OptoPrime places the entire computation graph in context, and the documentation warns that graphs with more than hundreds of operations may hit context-length limits.
- TextGrad avoids the same full-context limitation but may be very slow on large graphs.
- Performance varies by workflow, dataset, query, and response; human review is required, and the project warns against use in highly regulated, high-consequence domains.
- AutoGen support targets the v0.2-compatible path, so adopters using it must maintain an optional dependency and
OAI_CONFIG_LISTconfiguration.
How does this agent compare with similar options?
The README directly compares Trace with OPRO and TextGrad. OPRO has no computation graph, executable-function representation, or supporting library in the comparison, which makes it fast and suitable for large graphs. TextGrad supports computation graphs and a library but not code represented as functions, and is described as slower. Trace supports computation graphs, real Python functions, and a library interface while offering OPRO, OptoPrime, and TextGrad; the tradeoff is that OptoPrime places the full graph in model context and may encounter length limits on very large workflows.
Key facts side by side with the most closely related agents.
| Agent | Source review | Form / cost | Stars | Updated | Language | Full support on |
|---|---|---|---|---|---|---|
| Trace Generative Optimizer This agent | 51 · Major gaps | Library / SDKFree + model costs | ★ 767 | 1y ago | Python | OpenAI API · Claude API |
| Weco Autoresearch | 59 · Major gaps | CLIFree + model costs | ★ 127 | 29d ago | Python | Codex · Claude Code · OpenAI API |
| GEPA Reflective Optimizer | 52 · Major gaps | Library / SDKFree + model costs | ★ 7.7k | 3d ago | Jupyter Notebook | Codex · Claude Code · OpenAI API · Claude API |
| aiXplain SDK | 51 · Major gaps | Library / SDKFreemium | ★ 59 | 15d ago | Python | — |
How does FollowAgents rate this agent?
Why each dimension lost points
The README explains LLM backend and API key configuration and shows how optimizers receive feedback, giving some visibility into data flow. It does not specify which prompts, inputs, or feedback are sent to a backend, and it provides little evidence of sensitive-data protection, confirmation before calls, control of external effects, or rollback. Dependency security receives only thin support: LiteLLM and optional AutoGen are named, but no dependency audit or mitigation evidence is included. The README links the paper, project, and citation, and the LICENSE identifies Microsoft copyright, so attribution is clear.
The README, installation guide, and pyproject.toml do not fully agree about backends and dependencies: the README says LiteLLM is the default, the installation guide says optimizers require AutoGen, and metadata lists AutoGen as optional. CI is configured for unit tests, but the supplied test files do not show results. An example catches ExecutionError, but general API or configuration failure behavior is not explained, so consistency, dependency availability, and failure messages receive low scores.
The documentation targets Python developers and provides examples for basic optimization, LLM agents, multiple optimizers, robotics, and NLP. It also identifies beta status, OptoPrime's context limitation on large graphs, and domains where use is discouraged. This supports moderate scores for scenarios and environment fit. Trigger conditions are described mainly through the research purpose and examples, without precise task-selection or input requirements.
The README, installation guide, FAQ, license, security reporting instructions, and project metadata provide a usable information structure. Installation commands, tutorials, examples, limitations, and an explicit MIT license are present. Updates are mostly news items rather than a revision-linked changelog. Maintenance responsibility is partly supported by the README's statement that the authors maintain the project and check issue channels, plus Microsoft's security reporting path, but named maintainers and support timelines are not provided.
The examples show a basic path from trainable nodes and feedback to optimizer updates, and the optimizer choices and application tutorials demonstrate additional capability. The score is reduced because the README's agent example has an unimplemented decide_lang function, so its output is not a directly usable agent; the material also identifies large-graph context limits and slower TextGrad performance without enough evidence to quantify cost-benefit for ordinary tasks.
The README gives concrete descriptions of capabilities, installation, limitations, and research positioning, with some corroboration from pyproject.toml, the FAQ, license, and CI configuration. Performance and experiment claims are primarily asserted in the README and point to papers or figures; the supplied material does not independently verify results. The README also says performance varies and users are responsible for judging accuracy, providing some separation between claims and cautions.
- Trace calls the configured LLM backend. Confirm that prompts, user inputs, and feedback are appropriate to send to that service, and protect API keys.
- The README's agent example leaves decide_lang unimplemented, and the installation guide and package metadata differ on optimizer backend dependencies; verify the specific installation configuration.
- The project describes itself as research software in beta and calls for human oversight. It specifically discourages use in highly regulated domains or where errors could cause physical, legal, financial, or opportunity-related harm.
Recent releases
Latest entries from the project's GitHub Releases. Notes are quoted from upstream as written, not rewritten or tested by FollowAgents.
-
Release notes excerpt
This is a light update from v0.1.3.6. In this update, we fixed the line continuation error by adding the Python code formatting library Black. https://github.com/microsoft/Trace/issues/45 In addition, if the code update suggestion contains no method body (i.e., not even the function signature is present), then the update is silently ignored: updated by @chingancView on GitHub ↗ -
Release notes excerpt
This is a light update from v0.1.3.5. In this update, we have added the ability to switch between different LLM backends through setting environment variables. This update also fix the missing feature of running __iter__ over a node of numpy.ndarray, reported in https://github.com/microsoft/Trace/issues/41 .View on GitHub ↗ -
v0.1.3.5 Upgrade to v0.1.3.5
Release notes excerpt
This release includes changes up to v0.1.3.5. The major changes are - Migrate to use LiteLLM as the default backend (v0.1.3.5) - Bug fixes of bundle and TraceGraph (v0.1.3.4) - Various bug fixes and add small utility features (v0.1.3.1-v0.1.3.3) - Include AbstractModel and add asyncio tracing support (v0.1.3) - Include TextGrad as optimizer (v0.1.2) What's Changed * [ci] fix python unit test ci by @lalo in https://github.com/microsoft/Trace/pull/2 * fix error handling in extracting llm suggestion by @FrankZheng2022 in https://github.com/microsoft/Trace/pull/4 …View on GitHub ↗
FAQ
Does operating Trace require paid model APIs?
Is Trace limited to prompt optimization?
node marks trainable content, bundle wraps actual Python functions, and the computation graph can support joint optimization of prompts and code.Can I change the model backend or optimizer?
TraceGraph.What are the known scaling limitations?
Should it make unattended decisions in high-risk workflows?
Thanks — we use this to improve the page.
Subscribe to the FollowAgents RSS feed, or save this agent to your browser shortlist to compare on your next visit.