5a558eb09e
TypeScript SDK Compatibility V1.x E2E Tests / Select Node version matrix (push) Has been cancelled
TypeScript SDK Compatibility V1.x E2E Tests / TypeScript SDK Compatibility V1.x E2E Tests Node ${{matrix.node_version}} (push) Has been cancelled
TypeScript SDK E2E Tests / TypeScript SDK E2E Tests Node ${{matrix.node_version}} (push) Has been cancelled
Opik Optimizer - E2E Tests / build-opik (push) Has been cancelled
TypeScript SDK Compatibility V1.x E2E Tests / build-opik (push) Has been cancelled
Python SDK E2E Tests / Select Python version matrix (push) Has been cancelled
Python SDK E2E Tests / Python SDK E2E Tests ${{matrix.python_version}} (push) Has been cancelled
Python SDK E2E Tests / build-opik (push) Has been cancelled
Python SDK Compatibility V1.x E2E Tests / Select Python version matrix (push) Has been cancelled
Python SDK Compatibility V1.x E2E Tests / Python SDK Compatibility V1.x E2E Tests ${{matrix.python_version}} (push) Has been cancelled
Python SDK Compatibility V1.x E2E Tests / build-opik (push) Has been cancelled
TypeScript SDK E2E Tests / Select Node version matrix (push) Has been cancelled
TypeScript SDK E2E Tests / build-opik (push) Has been cancelled
Opik Optimizer - E2E Tests / Opik Optimizer E2E Tests Python ${{matrix.python_version}} (push) Has been cancelled
Opik Optimizer - E2E Tests / Opik Optimizer Integration Smoke Tests (push) Has been cancelled
🐙 Code Quality / detect (push) Has been cancelled
🐙 Code Quality / lint (${{ matrix.leg.name }}) (push) Has been cancelled
🐙 Code Quality / summary (push) Has been cancelled
TypeScript SDK Library Integration Tests / Check Secrets (push) Has been cancelled
TypeScript SDK Library Integration Tests / opik-vercel (Vercel AI SDK / eve) (push) Has been cancelled
SDK Library Integration Tests Runner / Check Secrets (push) Has been cancelled
SDK Library Integration Tests Runner / Missed OpenAI API Key Warning (push) Has been cancelled
SDK Library Integration Tests Runner / Build (push) Has been cancelled
SDK Library Integration Tests Runner / openai_tests (push) Has been cancelled
SDK Library Integration Tests Runner / langchain_tests (push) Has been cancelled
SDK Library Integration Tests Runner / langchain_legacy_tests (push) Has been cancelled
SDK Library Integration Tests Runner / llama_index_tests (push) Has been cancelled
SDK Library Integration Tests Runner / anthropic_tests (push) Has been cancelled
SDK Library Integration Tests Runner / mistral_tests (push) Has been cancelled
SDK Library Integration Tests Runner / groq_tests (push) Has been cancelled
SDK Library Integration Tests Runner / aisuite_tests (push) Has been cancelled
SDK Library Integration Tests Runner / haystack_tests (push) Has been cancelled
SDK Library Integration Tests Runner / dspy_tests (push) Has been cancelled
SDK Library Integration Tests Runner / crewai_v0_tests (push) Has been cancelled
SDK Library Integration Tests Runner / crewai_v1_tests (push) Has been cancelled
SDK Library Integration Tests Runner / genai_tests (push) Has been cancelled
SDK Library Integration Tests Runner / adk_tests (push) Has been cancelled
SDK Library Integration Tests Runner / adk_legacy_1_3_0_tests (push) Has been cancelled
SDK Library Integration Tests Runner / evaluation_metrics_tests (push) Has been cancelled
SDK Library Integration Tests Runner / bedrock_tests (push) Has been cancelled
SDK Library Integration Tests Runner / litellm_tests (push) Has been cancelled
SDK Library Integration Tests Runner / harbor_tests (push) Has been cancelled
SDK Library Integration Tests Runner / Slack Notification (push) Has been cancelled
Lint Opik Helm Chart / render-equality (push) Has been cancelled
Opik Optimizer - Unit Tests / Opik Optimizer Unit Tests Python ${{matrix.python_version}} (push) Has been cancelled
Python BE E2E Tests / Python BE E2E (push) Has been cancelled
Python Backend Tests / run-python-backend-tests (push) Has been cancelled
Python SDK Unit Tests / Python SDK Unit Tests ${{matrix.python_version}} (push) Has been cancelled
Release Drafter / update_release_draft (push) Has been cancelled
SDK E2E Libraries Integration Tests / Check Secrets (push) Has been cancelled
SDK E2E Libraries Integration Tests / Missed OpenAI API Key Warning (push) Has been cancelled
SDK E2E Libraries Integration Tests / build-opik (push) Has been cancelled
SDK E2E Libraries Integration Tests / E2E Lib Integration Python ${{matrix.python_version}} (push) Has been cancelled
TypeScript SDK Integration Build & Publish / build-and-publish (opik-gemini) (push) Has been cancelled
TypeScript SDK Integration Build & Publish / build-and-publish (opik-langchain) (push) Has been cancelled
TypeScript SDK Integration Build & Publish / build-and-publish (opik-openai) (push) Has been cancelled
TypeScript SDK Integration Build & Publish / build-and-publish (opik-otel) (push) Has been cancelled
TypeScript SDK Integration Build & Publish / build-and-publish (opik-vercel) (push) Has been cancelled
TypeScript SDK Build & Publish / build-and-publish (push) Has been cancelled
TypeScript SDK Unit Tests / Test on Node ${{ matrix.node-version }} (push) Has been cancelled
Backend Tests / discover-tests (push) Has been cancelled
Backend Tests / ${{ matrix.name }} (push) Has been cancelled
Build and Publish SDK / build-and-publish (push) Has been cancelled
Build Opik Docker Images / set-version (push) Has been cancelled
Build Opik Docker Images / build-backend (push) Has been cancelled
Build Opik Docker Images / build-sandbox-executor-python (push) Has been cancelled
Build Opik Docker Images / build-python-backend (push) Has been cancelled
Build Opik Docker Images / build-frontend (push) Has been cancelled
Build Opik Docker Images / create-git-tag (push) Has been cancelled
ClickHouse Migration Cluster Check / validate-clickhouse-migrations (push) Has been cancelled
Docs - Publish / run (push) Has been cancelled
E2E Tests - Post Merge (v2) / 🧪 E2E v2 Tests (${{ github.event.inputs.tier || 't1' }}) (push) Has been cancelled
E2E Tests - Post Merge (v2) / 📢 Slack Notification (push) Has been cancelled
Frontend Unit Tests / Test on Node 20 (push) Has been cancelled
Guardrails E2E Tests / Select Python version matrix (push) Has been cancelled
Guardrails E2E Tests / Guardrails E2E Tests ${{matrix.python_version}} (push) Has been cancelled
Guardrails E2E Tests / 📢 Slack Notification (push) Has been cancelled
Guardrails Backend Unit Tests / Guardrails Backend Unit Tests (push) Has been cancelled
Guardrails Backend Unit Tests / 📢 Slack Notification (push) Has been cancelled
Lint Opik Helm Chart / lint-helm-chart (Helm v3.21.0) (push) Has been cancelled
Lint Opik Helm Chart / lint-helm-chart (Helm v4.2.0) (push) Has been cancelled
Lint Opik Helm Chart / unittest-helm-chart (push) Has been cancelled
102 lines
8.4 KiB
Plaintext
102 lines
8.4 KiB
Plaintext
---
|
||
description: Learn about Opik's automated LLM prompt and agent optimization SDK. Discover
|
||
MetaPrompt, Few-shot Bayesian, and Evolutionary optimization algorithms for enhanced
|
||
performance.
|
||
headline: Opik Agent Optimizer | Opik Documentation
|
||
keywords: LLM optimization, prompt engineering, agent optimization, MetaPrompt, Few-shot
|
||
learning, Bayesian optimization, Evolutionary algorithms, DSPy
|
||
og:description: Learn to automate prompt and agent workflow tuning using Opik's optimization
|
||
SDK for improved performance and efficiency.
|
||
og:image: /img/agent_optimization/introducing.png
|
||
og:site_name: Opik Documentation
|
||
og:title: Optimize Prompts with Opik Agent Optimizer
|
||
title: Agent Optimization
|
||
canonical-url: https://www.comet.com/docs/opik/development/optimization-runs/overview
|
||
---
|
||
|
||
**Opik Agent Optimizer** is a turnkey, open-source agent and prompt optimization SDK. It automatically tunes prompts, tools, and agent workflows using the datasets, metrics, and traces you already log to Opik. Instead of hand-editing instructions and re-running evaluations, pick an optimizer (MetaPrompt, HRPO, Evolutionary, GEPA, etc.) and let it iterate for you online or fully offline inside Docker and Kubernetes.
|
||
|
||
<Frame>
|
||
<img src="/img/agent_optimization/dashboard.png" alt="Opik Agent Optimizer Dashboard showing optimization progress" />
|
||
</Frame>
|
||
|
||
## Why teams choose Opik Agent Optimizer
|
||
|
||
- **Automatic prompt optimization** – end-to-end workflow that installs in minutes and runs locally or in your stack.
|
||
- **Open-source and framework agnostic** – no lock-in, use Opik’s first-party optimizers or community favorites like GEPA in the same SDK.
|
||
- **Agent-aware** – optimize beyond system prompts, including MCP tool signatures, function-calling schemas, and multi-step agent workflows.
|
||
- **Deep observability** – every trial logs prompts, tool calls, traces, and metric reasons to Opik so you can explain and ship changes confidently.
|
||
|
||
## Key capabilities
|
||
|
||
<CardGroup cols={2}>
|
||
<Card title="Optimizer suite" href="/v1/agent_optimization/algorithms/overview" icon="fa-solid fa-diagram-project" iconPosition="left">
|
||
MetaPrompt, HRPO, Few-Shot Bayesian, Evolutionary, GEPA, Parameter tuning. Swap optimizers without changing your workflow.
|
||
</Card>
|
||
<Card title="Multi-agent + multi-prompt" href="/v1/agent_optimization/optimization/optimize_agents" icon="fa-solid fa-people-group" iconPosition="left">
|
||
Optimize full agent systems with multiple prompts, tools, and orchestration logic, not just a single system message.
|
||
</Card>
|
||
<Card title="Tool & function calling" href="/v1/agent_optimization/algorithms/tool_optimization" icon="fa-solid fa-screwdriver-wrench" iconPosition="left">
|
||
Optimize tool schemas and function calling alongside prompt text with the same metrics and datasets.
|
||
</Card>
|
||
<Card title="Dashboard analytics" href="/v1/agent_optimization/optimization/dashboard_results" icon="fa-solid fa-chart-line" iconPosition="left">
|
||
Track trials, candidates, datasets, and trace-level evidence to explain and ship improvements confidently.
|
||
</Card>
|
||
<Card title="Optimization Studio" href="/v1/agent_optimization/optimization_studio" icon="fa-solid fa-wand-magic-sparkles" iconPosition="left">
|
||
Run optimizer workflows directly from the UI with no-code configuration and result review.
|
||
</Card>
|
||
<Card title="Secure & offline" href="/v1/self-host/overview" icon="fa-solid fa-shield-halved" iconPosition="left">
|
||
Run the SDK locally or inside Opik Docker to keep data inside your network.
|
||
</Card>
|
||
</CardGroup>
|
||
|
||
## How it works
|
||
|
||
<Steps>
|
||
<Step title="1. Prepare data & metrics">
|
||
Use Opik datasets (CSV upload, API, or trace exports) plus deterministic metrics/`ScoreResult` functions. See [Define datasets](/v1/agent_optimization/optimization/define_datasets) and [Define metrics](/v1/agent_optimization/optimization/define_metrics).
|
||
</Step>
|
||
<Step title="2. Pick an optimizer">
|
||
Choose the best algorithm for your task (see [Optimization algorithms](/v1/agent_optimization/algorithms/overview)). All optimizers expose the same API, so you can swap them easily or chain runs.
|
||
</Step>
|
||
<Step title="3. Inspect & ship">
|
||
Results land in the Opik dashboard under **Evaluation → Optimization runs**, where you can compare prompts, failure modes, and dataset coverage before promoting the change.
|
||
</Step>
|
||
</Steps>
|
||
|
||
## Start fast
|
||
|
||
- Want a no-code workflow? Use [Optimization Studio](/v1/agent_optimization/optimization_studio) to run optimizations from the Opik UI.
|
||
- Follow the [Quickstart](/v1/agent_optimization/quickstart) to run your first optimization locally.
|
||
- Prefer notebooks? Launch the [Quickstart notebook](/v1/agent_optimization/cookbooks/optimizer_introduction_cookbook).
|
||
- Need scenario-specific guidance? Explore the [Cookbooks](/v1/agent_optimization/cookbooks/optimizer_introduction_cookbook).
|
||
|
||
## Optimization Algorithms
|
||
|
||
The optimizer implements both proprietary and open-source optimization algorithms. Each one has its
|
||
strengths and weaknesses, we recommend first trying out either GEPA or HRPO (Hierarchical Reflective Prompt Optimizer)
|
||
as a first step:
|
||
|
||
| **Algorithm** | **Description** |
|
||
| ------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||
| [MetaPrompt Optimization](/v1/agent_optimization/algorithms/metaprompt_optimizer) | Uses an LLM ("reasoning model") to critique and iteratively refine an initial instruction prompt. Good for general prompt wording, clarity, and structural improvements. **Supports [MCP tool calling optimization](/v1/agent_optimization/algorithms/tool_optimization).** |
|
||
| [HRPO (Hierarchical Reflective Prompt Optimizer)](/v1/agent_optimization/algorithms/hierarchical_adaptive_optimizer) | Uses hierarchical root cause analysis to systematically improve prompts by analyzing failures in batches, synthesizing findings, and addressing identified failure modes. Best for complex prompts requiring systematic refinement based on understanding why they fail. |
|
||
| [Few-shot Bayesian Optimization](/v1/agent_optimization/algorithms/fewshot_bayesian_optimizer) | Specifically for chat models, this optimizer uses Bayesian optimization (Optuna) to find the optimal number and combination of few-shot examples (demonstrations) to accompany a system prompt. |
|
||
| [Evolutionary Optimization](/v1/agent_optimization/algorithms/evolutionary_optimizer) | Employs genetic algorithms to evolve a population of prompts. Can discover novel prompt structures and supports multi-objective optimization (e.g., score vs. length). Can use LLMs for advanced mutation/crossover. |
|
||
| [GEPA Optimization](/v1/agent_optimization/algorithms/gepa_optimizer) | Wraps the external GEPA package to optimize a single system prompt for single-turn tasks using a reflection model. Requires `pip install gepa`. |
|
||
| [Parameter Optimization](/v1/agent_optimization/algorithms/parameter_optimizer) | Optimizes LLM call parameters (temperature, top_p, etc.) using Bayesian optimization. Uses Optuna for efficient parameter search with global and local search phases. Best for tuning model behavior without changing the prompt. |
|
||
|
||
<Tip>
|
||
Want to see numbers? Check the new [optimizer benchmarks](/v1/agent_optimization/algorithms/benchmarks) page for the latest performance table and instructions for running the benchmark suite yourself.
|
||
</Tip>
|
||
|
||
## Next Steps
|
||
|
||
1. Explore specific [Optimizers](/v1/agent_optimization/algorithms/overview) for algorithm details.
|
||
2. Refer to the [FAQ](/v1/agent_optimization/faq) for common questions and troubleshooting.
|
||
3. Refer to the [API Reference](/v1/agent_optimization/advanced/api_reference) for detailed configuration options.
|
||
|
||
<Info>
|
||
🚀 Want to see Opik Agent Optimizer in action? Check out our [Example Projects & Cookbooks](/v1/agent_optimization/cookbooks/optimizer_introduction_cookbook) for runnable Colab notebooks covering real-world optimization workflows, including HotPotQA and synthetic data generation.
|
||
</Info>
|