Skip to main content
This guide will walk you through the essential steps to optimize your first prompt using the agent-opt Python library. We’ll use the RandomSearchOptimizer to keep things simple and demonstrate the core workflow.

1. Installation and Setup

First, install the library and set up your environment variables to connect to Future AGI for evaluations. You can get your API keys from the Future AGI dashboard.

2. Prepare Your Dataset

Optimization is data-driven. You’ll need a dataset, which is a simple list of Python dictionaries. For this example, we’ll create a small dataset for a summarization task.

3. Configure and Run the Optimization

Now, let’s set up the components and run the optimization. We’ll configure an Evaluator to score our prompts, a DataMapper to connect our data, and the RandomSearchOptimizer to run the process.

4. Analyze the Results

The result object contains the best prompt found and its final score.

5. Next Steps

You’ve successfully optimized your first prompt! From here, you can explore more advanced strategies.

Optimizers Overview

Compare all available optimizers and find the best one for your task.

Python SDK Guide

Take a deeper dive into the SDK’s features and advanced configurations.