Trace2

Getting Started

Get up and running with Trace2 in minutes

Getting Started with Trace2

Welcome! This guide will help you install, configure, and start using Trace2.

What You'll Learn

In this section, you'll learn how to:

  • ✅ Install Trace2 and its dependencies
  • ✅ Configure LLM backends (OpenAI, Anthropic, etc.)
  • ✅ Build your first optimizable function
  • ✅ Run your first optimization

Quick Navigation

Installation (30 seconds)

pip install trace-opt

That's it! Trace2 is now installed.

Set Up Your API Key (1 minute)

import os
os.environ['OPENAI_API_KEY'] = 'your-api-key-here'

Your First Example (2 minutes)

from opto.trace import node, bundle
from opto.optimizers import OptoPrime

@bundle(trainable=True)
def greet(name):
    """Greet the user."""
    return f"Hey {name}"

optimizer = OptoPrime(greet.parameters())

# Optimize the greeting to be more professional
output = greet("Alice")
feedback = "Make it more professional and formal"

optimizer.zero_feedback()
optimizer.backward(output, feedback)
optimizer.step()

# Try again
print(greet("Alice"))  # Should be more formal now!

What's Next?

Choose your path:

🚀 Fast Track

Jump straight to the Quick Start and build something!

📚 Deep Dive

Learn the Core Concepts to understand how Trace2 works.

💡 Learn by Example

Browse Examples to see Trace2 in action.

Need Help?

Prerequisites

You should be comfortable with:

  • Python programming (3.10+)
  • Basic machine learning concepts
  • Using APIs (optional)

No prior experience with optimization or LLMs required!