# AlphaEvolve

> A Gemini-powered evolutionary coding agent that searches for faster algorithms against a scoring function you define

- Category: AI Coding / Autonomous Coding Agents
- Language: Python
- Licence: Apache-2.0
- Repository: https://github.com/Google-Cloud-AI/alphaevolve-on-googlecloud
- Website: https://docs.cloud.google.com/gemini/enterprise/docs/alphaevolve/developer-guide/overview
- Canonical page: https://ai-tldr.dev/tools/alphaevolve/
- Updated: 2026-07-09

## In short

AlphaEvolve is an evolutionary coding agent for general-purpose algorithm discovery and optimization. It sits in the Autonomous Coding Agents category of the AI Coding tools and is open-source, written in Python and licensed Apache-2.0. To get started: clone the repo and install the library.

## Overview

AlphaEvolve is an evolutionary coding agent for general-purpose algorithm discovery and optimization. You provide a seed program that already works and a scoring function that says what "better" means; AlphaEvolve uses Gemini to propose code changes, evaluates each candidate against your metric, and evolves the population over many generations toward higher-scoring programs. Google's documentation frames it as a fit for algorithmic discovery, mathematical search and combinatorial optimization — including NP-complete and NP-hard problems where the win comes from redesigning the algorithm, not tidying the code.

It is deliberately not a general code assistant. The documentation is explicit that AlphaEvolve is not for basic code generation, linting or cleanup: it starts from functionally correct code that needs a better score, and it needs a large space of functionally correct alternatives to search through. The trade-off is compute — a run is a long loop of generate, evaluate, select, so cost scales with how many candidates you are willing to evaluate.

The service runs inside your own Google Cloud project through the Gemini Enterprise Agent Platform. The public repository is the client side: a Python library (`alpha_evolve`) plus runnable examples that wire AlphaEvolve into real Google Cloud environments, from a pure-Python loop with no infrastructure at all up to GPU training on GKE. The library is Apache-2.0, but running it requires a Google Cloud project with AlphaEvolve provisioned, which gives you the Gemini Enterprise App/Engine ID the examples expect.

## What it does

- Evolutionary search over programs: Gemini proposes code changes, each candidate is evaluated against your scoring function, and the population evolves across generations
- You define the objective — the agent optimizes whatever metric your evaluator returns, rather than a fixed notion of code quality
- An open Python client library (`alpha_evolve`) with runnable examples spanning local evaluation, Cloud Run and GPU training on GKE
- Parallel evaluation via PARALLEL_EVALUATION and WORKER_CONCURRENCY settings, so candidates are scored concurrently
- Runs inside your own Google Cloud project through the Gemini Enterprise Agent Platform
- AlphaEvolve Skills for driving runs from an agent environment, documented alongside the library

## Getting started

The Circle Packing example runs the full evolution loop with local Python evaluation and no cloud infrastructure beyond the AlphaEvolve API — the fastest way to watch the loop work. You need Python 3.9+, uv, the gcloud CLI, and a Google Cloud project with AlphaEvolve provisioned.

1. Clone the repo and install the library

   The client package lives in src/ and installs with the examples extra.

```bash
git clone https://github.com/Google-Cloud-AI/alphaevolve-on-googlecloud.git
cd alphaevolve-on-googlecloud
uv pip install -e ".[examples]"
```

2. Configure the Circle Packing example

   `make setup` creates a .env from the template; edit it to set PROJECT_ID and the Gemini Enterprise App ID (GE_APP_ID) you got when AlphaEvolve was provisioned.

```bash
cd examples/circle_packing
make setup
```

3. Authenticate

   Application default credentials are what the client uses to reach the AlphaEvolve API.

```bash
make auth
```

4. Run the experiment

   `make run` uploads the seed algorithm, then evolves and evaluates candidates. Each generation's best score is logged, and the example plots the top packings at the end. Run `make help` in any example to see its targets.

```bash
make run
```

5. Evaluate candidates in parallel

   Set these in .env to score several candidates at once instead of one at a time.

```bash
PARALLEL_EVALUATION=True
WORKER_CONCURRENCY=8
```

## When to use it

- Search for a faster implementation of a hot algorithm when you can write an automated benchmark that scores each candidate
- Attack combinatorial optimization problems — packing, scheduling, routing — where many functionally correct programs exist and only the score separates them
- Explore mathematical constructions by encoding the construction as a program and the objective as a metric
- Tune a kernel or training configuration on GKE by letting the loop propose and measure variants instead of sweeping by hand

## Version history

- 2026-07-09: AlphaEvolve became generally available on the Gemini Enterprise Agent Platform for every Google Cloud customer, after seven months in private preview.
