Quickstart
Opik Agent Optimizer Quickstart gives you the fastest path from “hello world” to a successful optimization run. If you already walked through the main Opik Quickstart (tracing + evaluation), this is the next stop—it layers on the opik-optimizer SDK so you can automatically improve prompts and agents.
Why Opik Agent Optimizer?
- Production-grade workflows – reuse the same datasets, metrics, and tracing you already have in Opik.
- Multiple strategies – swap between MetaPrompt, Hierarchical Reflective, Evolutionary, GEPA, and more with one API.
- Deep analysis – every trial is logged to Opik so you can inspect prompts, tool calls, and failure modes.
Estimated time: ≤10 minutes if you already have Python and an Opik API key configured.
Prerequisites
- Python 3.10+
- Opik account
- Access to an OpenAI-compatible LLM via LiteLLM (
OPENAI_API_KEY,ANTHROPIC_API_KEY, etc.)
1. Install and authenticate
2. Create a dataset and metric
3. Run the optimizer
4. Inspect results
- Run
opik dashboardor open https://www.comet.com/opik. - In the left nav, go to Evaluation → Optimization runs, then select your latest run.
- Review the optimization-progress chart, trial table, and per-trial traces to decide whether to ship the new prompt.
Common first issues
Prompt must be a ChatPrompt object
Import ChatPrompt from opik_optimizer and wrap your messages list before passing it to any optimizer.
Authentication failed
Re-run opik configure and confirm the account has Agent Optimizer access. If you changed machines, copy the ~/.opik/config file or re-enter the key.
liteLLM provider errors
Ensure provider keys (e.g., OPENAI_API_KEY) are exported in the same shell running the script, and verify the model you selected is enabled for that key.
Next steps
- Prefer notebooks? Launch the Quickstart notebook.
- Dive deeper into Define datasets and Define metrics.
- Explore the Optimization Algorithms overview to pick the best strategy for your workload.