For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Copy to LLMGithubGo to App
DocumentationIntegrationsBuilding Self-Improving AgentsSelf-hosting OpikSDK & API reference
DocumentationIntegrationsBuilding Self-Improving AgentsSelf-hosting OpikSDK & API reference
  • Getting Started
    • Home
    • Quickstart
    • Upgrading to Opik 2.0
    • Ollie Agent
    • FAQ
    • Changelog
  • Observability
    • Overview
    • Getting started
    • Concepts
    • Debugging agents with Ollie and Opik Connect
  • Development
    • Overview
    • Agent playground
    • Prompt playground
      • Opik Agent Optimizer
      • Optimization Studio
      • Quickstart
      • Quickstart notebook
      • FAQ
      • Changelog
      • Known Issues
        • Concepts
        • Configure LLM Providers
        • Define datasets
        • Define metrics
        • Optimize prompts
        • Optimize tools (MCP)
        • Optimize agents
        • Optimize multimodal
        • Dashboard results
  • Evaluation
    • Overview
    • Getting started
    • Concepts
  • Production
  • Administration
    • Overview
    • Roles and Permissions
  • Contributing
    • Contribution Overview
LogoLogo
Copy to LLMGithubGo to App
On this page
  • Overview
  • What is Agent Optimization (and Prompt Optimization)?
  • Key Terms
  • Next Steps
DevelopmentOptimization runsOptimization

Opik Agent Optimizer Core Concepts

Common terminology and how we optimize
Was this page helpful?
Previous

Configuring LLM Providers

Use any LLM provider with the Opik Optimizer
Next
Built with

Overview

Understanding the core concepts of the Opik Agent Optimizer is essential for unlocking its full potential in LLM evaluation and optimization. This section explains the foundational terms, processes, and strategies that underpin effective agent and prompt optimization within Opik.

What is Agent Optimization (and Prompt Optimization)?

In Opik, Agent Optimization refers to the systematic process of refining and evaluating the prompts, configurations, and overall design of language model-based applications to maximize their performance. This is an iterative approach leveraging continuous testing, data-driven refinement, and advanced evaluation techniques.

Prompt Optimization is a crucial subset of Agent Optimization. It focuses specifically on improving the instructions (prompts) given to Large Language Models (LLMs) to achieve desired outputs more accurately, consistently, and efficiently. Since prompts are the primary way to interact with and guide LLMs, optimizing them is fundamental to enhancing any LLM-powered agent or application.

Opik Agent Optimizer provides tools for both: directly optimizing individual prompt strings and also for optimizing more complex agentic structures that might involve multiple prompts, few-shot examples, or tool interactions.

Key Terms

Optimizer

A specialized algorithm within the Opik Agent Optimizer SDK designed to enhance prompt effectiveness. Each optimizer (e.g., MetaPromptOptimizer, FewShotBayesianOptimizer, EvolutionaryOptimizer, HRPO) employs unique strategies and configurable parameters to address specific optimization goals.

ChatPrompt

The object to optimize which contains your chat messages with placeholders for variables that change on each example. See the API Reference.

Candidate

A concrete prompt (or multi-prompt bundle) produced by an optimizer for evaluation. Candidates are what get scored and compared during optimization, and each candidate maps to a specific set of messages, parameters, and tool configuration.

Metric

An object defining how to measure the performance of a prompt. The metric functions should accept two parameters:

  • dataset_item: A dictionary with the dataset item keys
  • llm_output: This will be populated with the LLM response

It should return either a ScoreResult object or a float.

Dataset (for Optimization)

A collection of data items, typically with inputs and expected outputs (ground truth), used to guide and evaluate the prompt optimization process. For best results, split your data into separate training and validation datasets—the optimizer uses the training dataset to analyze failures and generate improvements, then evaluates candidates on the validation dataset to prevent overfitting. See Datasets and Define datasets for more information.

Optimization Run

A single execution of a prompt optimization process using a specific configuration. For example, calling optimizer.optimize_prompt(...) once constitutes a Run. Each Run is logged as an Optimization Run in Opik and contains multiple rounds, trials, and candidate evaluations.

Optimization Trial

Each optimization run is made up of one or more optimization trials. A trial corresponds to evaluating a candidate on the chosen dataset slice (full, sampled, or minibatch). You can view each trial’s prompt, score, and reasoning history inside the Opik UI to understand optimizer progress.

Optimization Round

A logical iteration within a run where the optimizer proposes one or more candidates, evaluates them, and uses the results to decide the next candidates. Some optimizers expose rounds explicitly (e.g., evolutionary, hierarchical), while others operate with a simpler trial-by-trial loop.

Prompt model

The model that is used to evaluate the prompt. This is the model that you use the prompt with, should be the same as the model you use in your application. Configure it via ChatPrompt(model="provider/model-name").

See Configure LLM Providers for setup instructions.

Optimizer model

The model that is used to optimize the prompt. This is the model that the optimizer uses to improve your prompt, you will get the best performance by using the most powerful model for the optimization. Configure it via the optimizer’s model parameter.

See Configure LLM Providers for setup instructions.

Next Steps

  • Explore specific Optimizers for algorithm details.
  • Refer to the FAQ for common questions and troubleshooting.
  • Refer to the API Reference for detailed configuration options.

📓 Want to see these concepts in action? Check out our Example Projects & Cookbooks for step-by-step, runnable Colab notebooks.