Metadata-Version: 2.5
Name: avalanche-ai
Version: 0.20.25
Summary: Python toolkit for local data-flow experiments with Iceberg and Lance
Author-email: Gabriel Lesperance <611342+glesperance@users.noreply.github.com>
License: MIT License
        
        Copyright 2026 Trampoline AI Inc.
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.13
Requires-Python: <3.14,>=3.13
Requires-Dist: cloudpickle<4,>=3.1
Requires-Dist: croniter>=6.2.2
Requires-Dist: fastapi<1,>=0.115
Requires-Dist: grpcio>=1.85.1
Requires-Dist: httpx<1,>=0.27
Requires-Dist: protobuf>=6.31.1
Requires-Dist: pydantic<3,>=2
Requires-Dist: python-dotenv>=1.0
Requires-Dist: python-ulid>=3.0.0
Requires-Dist: pyyaml>=6
Requires-Dist: textual>=6.2.1
Requires-Dist: uvicorn<1,>=0.30
Requires-Dist: watchfiles>=1.1.1
Provides-Extra: agents
Requires-Dist: predict-rlm[codex-lm]<0.14,>=0.13.2; extra == 'agents'
Provides-Extra: claude
Requires-Dist: claude-agent-sdk>=0.2.174; extra == 'claude'
Requires-Dist: predict-rlm[codex-lm]<0.14,>=0.13.2; extra == 'claude'
Provides-Extra: dataframes
Requires-Dist: dataframely<2,>=1.13.0; extra == 'dataframes'
Requires-Dist: polars<1.35,>=1.34; extra == 'dataframes'
Requires-Dist: pyarrow>=24; extra == 'dataframes'
Provides-Extra: gemini
Requires-Dist: google-genai>=3.2.0; extra == 'gemini'
Provides-Extra: iceberg
Requires-Dist: dataframely<2,>=1.13.0; extra == 'iceberg'
Requires-Dist: polars<1.35,>=1.34; extra == 'iceberg'
Requires-Dist: pyarrow>=24; extra == 'iceberg'
Requires-Dist: pyiceberg[glue,pandas,pyarrow,s3fs,sql-sqlite]<0.11,>=0.9; extra == 'iceberg'
Provides-Extra: integrations
Requires-Dist: authlib<2,>=1.6; extra == 'integrations'
Requires-Dist: mcp<3,>=2.3; extra == 'integrations'
Provides-Extra: lance
Requires-Dist: dataframely<2,>=1.13.0; extra == 'lance'
Requires-Dist: filelock<5,>=4.2.1; extra == 'lance'
Requires-Dist: polars<1.35,>=1.34; extra == 'lance'
Requires-Dist: pyarrow>=24; extra == 'lance'
Requires-Dist: pylance>=0.24.0; extra == 'lance'
Provides-Extra: openai
Requires-Dist: openai-agents>=0.24.0; extra == 'openai'
Requires-Dist: openai>=3.37.0; extra == 'openai'
Requires-Dist: predict-rlm[codex-lm]<0.14,>=0.13.2; extra == 'openai'
Provides-Extra: typesafe
Requires-Dist: typesafe-sdk>=0.6.0; extra == 'typesafe'
Description-Content-Type: text/markdown

<p align="center">
  <img src="docs/assets/brand/avalanche-logo-3d.png" alt="Avalanche" width="600" />
</p>

# Avalanche

Avalanche makes agents first-class steps in typed data pipelines. Compose adaptive agent work with deterministic Python transformations in one DAG, run it through the Avalanche operator, and inspect every run from the web UI.

<br>
<p align="center">
  <a href="https://github.com/Trampoline-AI/avalanche/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/Trampoline-AI/avalanche/ci.yml?label=Tests" alt="Tests"></a>
  <a href="https://pypi.org/project/avalanche-ai/"><img src="https://img.shields.io/pypi/v/avalanche-ai?color=blue" alt="PyPI"></a>
  <a href="https://pypi.org/project/avalanche-ai/"><img src="https://img.shields.io/pypi/pyversions/avalanche-ai" alt="Python"></a>
  <a href="https://discord.gg/BAkd288sGN"><img src="https://img.shields.io/badge/Discord-Join-5865F2?style=flat&logo=discord&logoColor=white" alt="Discord"></a>
  <a href="https://github.com/Trampoline-AI/avalanche"><img src="https://img.shields.io/github/stars/Trampoline-AI/avalanche?cacheSeconds=3600" alt="GitHub stars"></a>
  <br/>
  crafted with ♥ in MTL · NYC · FLP<br/>by <a href="https://trampoline.ai">Trampoline AI</a>
</p>

<p align="center">
  <img src="docs/assets/screenshots/output-onlinegiftools-half.gif" alt="Avalanche workflow demo" width="100%" />
</p>

> [!NOTE]
> Avalanche is an early release candidate intended for local development and experimentation. APIs and operational behavior may change before a stable release.

## API reference

The [API reference](docs/api/README.md) covers the interfaces used to write and run
workflows: step decorators, graph operations, run handles, inputs and context,
files and workspaces, agents, classifiers, Iceberg/Lance storage, streams,
cursors, and CLI commands. Entries list parameters, fields, returns, and errors.
The same reference is bundled in the [Avalanche skill](skills/avalanche/SKILL.md)
for offline API lookup.

## Requirements

- Python 3.13.
- A LLM provider API key or Codex subscription for agent steps.
- uv (recommended, https://docs.astral.sh/uv/)

## Quickstart

Move into an empty directory, then run this command to initialize a starter
project with the Avalanche skill installed and an example workflow:

```bash
uvx avalanche-ai@latest init
```

The starter workflow's agent step uses `openai/gpt-5.5` by default, so if you have an
OpenAI key you can run the demo as is:

```bash
export OPENAI_API_KEY=...
uv run ava dev
```

To use another provider, change `lm` and `sub_lm` in `src/start_flow/flow.py` and set
that provider's key instead. The starter project's `README.md` explains how.

This starts the operator and opens the browser UI at `http://127.0.0.1:7435`.

You can then use the provided avalanche skill to create your own workflow by describing your wanted outcome to your agent:

```bash
/avalanche <outcome>
```

The starter project also installs the `delta` CLI for deploying workflows to Delta
Cloud. Sign in, link the project once, then deploy:

```bash
uv run delta login
uv run delta init --org <ORG_ID> --project proj_<name>
uv run delta deploy
```

## Installation

Plain installation keeps workflow execution, `ava dev`, the local operator and TUI.
Add only the features your project uses; combine names, for example
`uv add 'avalanche-ai[agents,integrations]'`.

| Extra | Purpose |
| --- | --- |
| `agents` | PredictRLM agent steps, including the Codex LM and Deno runtime. |
| `dataframes` | Polars dataframes, Dataframely typed schemas and Arrow conversion. |
| `integrations` | MCP server connections and OAuth logins. |
| `typesafe` | TypeSafe classification and evaluation. |
| `iceberg` | Iceberg tables; includes `dataframes`. |
| `lance` | Lance tables and FileLock; includes `dataframes`. |
| `openai` | OpenAI agent runtime and Decisions classifier; includes `agents`. |
| `gemini` | Gemini Decision classifier. |
| `claude` | Claude agent runtime; includes `agents`. |

Starter projects select `agents` for their included agent step. Other projects
must declare their own extras. Missing feature dependencies report the matching
`uv add 'avalanche-ai[<extra>]'` command on first use. See
[installation](docs/installation.md) for details.

### Option A — Starter project (recommended)

Create an empty directory, move into it, and run:

```bash
uvx avalanche-ai@latest init
```

This installs a ready-to-run starter project with its dependencies, the Avalanche
authoring skill, and `start_flow`, a starter workflow with a plain step and an agent
step. Its key structure is:

```text
.
├── .agent/
│   └── skills/
│       └── avalanche/                # Avalanche workflow creation skill
├── src/                              # workflows live here
│   └── start_flow/
│       └── flow.py                   # included example workflow
├── AGENTS.md
├── README.md                         # running start_flow, runtimes and model choices
├── pyproject.toml
└── uv.lock
```

Its agent step uses `openai/gpt-5.5` by default, so to run it as is, set
`OPENAI_API_KEY`, then run `uv run ava dev`. To use another provider, change `lm` and
`sub_lm` in `src/start_flow/flow.py` and set that provider's key instead. The starter
project's `README.md` explains how, and lists the agent runtimes, what models each one
supports, and how to give it credentials.

#### Local checkout dependencies

To develop Avalanche and PredictRLM alongside a new workspace, initialize an
empty directory with editable dependencies:

```bash
uvx avalanche-ai@latest init --editable-deps
```

This clones both Trampoline AI projects into `.trampoline-ai/` and configures
them as local editable dependencies, so changes to either checkout are used
immediately by the workspace.

### Option B — Existing project

Avalanche is also usable as a project dependency.

Add Avalanche to an existing project:

```bash
uv add avalanche-ai
```

Plain workflows need no storage extra. For Iceberg tables and their table-backed
streams, install Iceberg support in the environment that runs the flow:

```bash
uv add "avalanche-ai[iceberg]"
```

Install the avalanche skill in the same project:

```bash
npx skills add avalanche-run/avalanche
```

## Usage

### Creating a workflow

Connect Python steps and agent calls with `>>` inside an `@ava.workflow`:

```python
@ava.source
def load_text() -> str:
    return "Hello world"


@ava.workflow
def feedback_workflow():
    return load_text() >> ava.agent.step(
        ava.Signature("text: str -> completion: str")
    )
```

Inline agents return validated signature outputs. Use a decorated agent function
when you need custom preparation, transformation, or persistence.
See [agent steps](docs/agent-steps.md) or
[classifier steps](docs/classifier-steps.md) for fixed-choice classification.

We recommend using the skill directly in order to have your agent align on a goal and build a workflow for you.

Open your coding agent in the same project where you installed avalanche, then:

```
/avalanche <Describe your wanted outcome here>
```

for codex:

```
$avalanche <Describe your wanted outcome here>
```

### Running the operator and Web UI

In a workspace configured with `[tool.avalanche].flow_targets`, the operator
scans that code for workflows, then loads and runs them:

```bash
uv run ava operator
```

This also serves the Web UI and development REST API at
`http://127.0.0.1:7435`. Open that address in your browser, or use `ava dev`
to open it automatically:

```bash
uv run ava dev
```

`ava init` writes this workspace configuration, so the starter command scans
every Python workflow below `src/`:

```toml
[tool.avalanche]
flow_targets = ["src"]
```

`operator` and `dev` use `flow_targets` when positional `FLOW` values are
omitted. Configuration paths are relative to that `pyproject.toml`. Passing one
or more `FLOW` values replaces the configuration rather than adding to it:

```bash
uv run ava operator ./flows ./shared_flows --port 7433
```

Without explicit targets or a nonempty `flow_targets` setting, the command
stops before starting services. It never scans the current directory by default.

Discovery allows 60 seconds per scan by default. Pass `--discovery-timeout SECONDS`
to `ava operator` or `ava dev` to set a different positive, finite limit.

> [!WARNING]
> Discovery imports eligible Python modules beneath each target. Use a specific
> flow file or dedicated flow directory, not a mixed repository root.

For a separate HTTP listener, start the operator with `--no-web`, then connect:

```bash
uv run ava web --connect localhost:7433
```

The operator defaults to `127.0.0.1:7433` and the Web UI/REST listener to
`http://127.0.0.1:7435`. Use `--web-port` with `ava operator` or `ava dev`
to change the HTTP port; `ava web` uses `--port` instead.

### Where the operator keeps its data

`ava operator` and `ava dev` keep what they know in a SQLite database, by default
`.avalanche/operator/state.db` under the folder you start them in (pass
`--state-db PATH` to choose another file, or `--state-db :memory:` for a throwaway
one). Next to it are four folders:

| Path | Holds |
| --- | --- |
| `state.db` | Runs and their step states, logs, agent and classifier events, traces, evaluations, the result index, and each schedule's on/off state, input and last trigger |
| `results/` | Result bundles of successful runs, served by `ava result RUN_ID` |
| `input-files/` | Uploaded run input files; the ones a run used are kept with it |
| `schedule-inputs/` | Copies of the files a schedule's input uses |
| `step-outputs/` | Each successful step's return value as JSON, with copies of its files |

So run history, traces, logs, evaluations, results and schedules survive an
operator restart, including a crash or `kill -9`. What does not survive:

- An ordinary flow run that was still running when the operator stopped is **not resumed**. The
  next start stops any of its processes still alive, then marks it and its
  unfinished steps failed with "Operator restarted before the run finished; it was
  not resumed". An evaluation still pending is marked failed the same way.
- `--schedules-enabled` applies to one start only; it is not saved.

One database serves one operator at a time: a second operator, or an `ava state`
command, on a database in use fails with an error naming the file. Use one folder
per database, since the folders next to it belong to it alone. A database written
by a newer Avalanche version is refused. The database and folders are local and
**not encrypted**, and they hold step inputs, tool outputs, logs and results as
they were. Keep them on a local disk (not a network share), out of version control
(`.avalanche/` is a good line for `.gitignore`), and out of anything you share.

Nothing is deleted automatically: no time limit and no size limit. Use
[`ava state`](docs/api/cli.md#ava-state-command-options---state-db-path) with the
operator stopped to see and clear it:

```bash
uv run ava state info                    # location, sizes, runs by status, leftovers
uv run ava state prune --keep-last 20    # delete older finished runs
uv run ava state delete RUN_ID           # delete one finished run and its files
uv run ava state clear                   # delete every run (asks first)
```

Machine runs additionally keep their key, state entries, inbox, receipts and absolute
timer deadlines in this database, and all state entries of an instance share one
workspace folder. A waiting machine re-arms its timers after a
restart; an overdue timer fires once. A state entry interrupted in the middle of work
has an unknown outcome and is not replayed automatically. Use
`ava run retry RUN_ID --entry` to start a new state entry in the same state, or
`ava run cancel RUN_ID`. This does not resume arbitrary unfinished flow DAGs.
A run parked on `ava.call` reattaches to its original child after a restart.
See [state machines](docs/state-machines.md#run-locally).

SQLite uses WAL and `synchronous=FULL`; accepted receipts and transitions commit
before being acknowledged or published. There is no shared/multi-operator
recovery, authentication, encryption or backup. Keep a backup of the database
and its sibling folders together. Manual `ava state` deletion is destructive,
but retains permanent keyed-run identity and reports the data as `expired`;
it is not a machine rerun mechanism. Removing the database itself resets identity.

### Application environment for self-hosters

State entries inherit the environment of the operator process, like ordinary flow runs.
There is no local hosted-secret manager. Load a private environment file before
starting the operator (or use your service manager's environment-file facility):

```sh
# Trusted shell assignments; never source an untrusted file.
set -a
. ./operator.env
set +a
ava operator ./flows --state-db .avalanche/operator/state.db
```

Keep `operator.env` out of version control and restrict its permissions to its
owner (`chmod 600 operator.env`). Do not print its contents in logs. Changing an
environment file requires restarting the operator; waiting machine timers and
records survive, but an in-flight state entry becomes interrupted.

### Development REST API

The built-in API is available under `/api/v1` on the same listener as the Web UI.
It translates JSON requests into the existing operator gRPC calls; it does not
add a deployment service or a separate run store. Machine sections and controls
are subordinate to their normal run IDs.
FastAPI defines the REST routes, and Uvicorn serves the shared HTTP listener.
Both are regular runtime dependencies installed with Avalanche, not contributor-only
development dependencies. Interactive API documentation is available at `/api/docs`,
with the OpenAPI schema at `/api/openapi.json`.

`ava operator` and `ava dev` bind HTTP to loopback. There is no built-in
authentication; do not expose it to an untrusted network. A separately launched
`ava web --host ... --trusted-proxy` requires an external authenticated boundary.

| Method | Path (under `/api/v1`) | Response |
| --- | --- | --- |
| GET | `/flows` | Discovered flows and their `workflow_selector` values |
| POST | `/flows/{workflow_selector}/schedule` | Body `{"enabled": true}` enables a cron schedule, `false` disables it; when enabling, optional `input_json` sets the input object its runs start with. Returns the updated flow |
| POST | `/runs` | `202` with `run_id`; execution continues asynchronously |
| GET | `/runs` | Paginated run summaries |
| GET | `/runs/{run_id}` | Snapshot with `summary`, node states, and topology |
| POST | `/runs/{run_id}/cancel` | `200` acknowledging cancellation; poll for terminal state |
| GET | `/runs/{run_id}/output` | Retained result value and file descriptors |
| GET | `/runs/{run_id}/result` | Typed run, state entry (`entry`) or step (`node_id`) result |
| GET | `/runs/{run_id}/links` | Parent and child runs started by `ava.call` or `ava.start_run` |
| GET | `/runs/{run_id}/activity` | Paginated log or node-event descriptors |

Percent-encode run IDs and workflow selectors when placing them in URL paths.
Each flow reports `schedule_enabled` and, once set, `schedule_input_json`;
schedules start disabled with the workflow's default input, and a disabled
schedule has no `next_run_at`. Whether a schedule is enabled, and its input, are
kept in the operator's [state database](#where-the-operator-keeps-its-data): they
survive rediscovery, source reload and operator restarts. Each run summary's `triggered_by` is `scheduled`, `manual` (the Web UI or TUI),
`webhook`, or `api` (REST, gRPC, and `ava run` callers). Application errors use a
JSON `error` object with `code` and `message`; malformed HTTP framing can be
rejected by Uvicorn before the request reaches the API.

### Embedding the operator UI

`@avalanche-run/operator-ui` is the embeddable React package for an Avalanche operator
interface. It exports `OperatorUi`, `WorkflowWorkspace`, `GrpcWebOperatorApi`, and their
typed host APIs. The embedding host owns its `OperatorApi` implementation and presentation
configuration.

The UI is source-only; 0.20.15 was its last GitHub Packages publication. Hosts
consume `web/operator` from the same source checkout, add it to their pnpm
workspace, and depend on `@avalanche-run/operator-ui` with `workspace:*`. Build
that package before the host so its `dist` exports are available. The in-repo
local host and Delta console use this pattern; no registry token is required.

```tsx
import "@avalanche-run/operator-ui/styles.css";
import { OperatorUi } from "@avalanche-run/operator-ui";
```

Avalanche does not provide a remote operator endpoint or authentication boundary for an
embedding host.

### Releasing Avalanche and the operator UI

The Python distribution and source UI retain one shared version and release
tag. In the monorepo, use `scripts/releases/bump-version.py` to update versions;
follow the root release runbook rather than releasing from the public mirror.
The UI version still advances with the SDK, but no npm package is published.

Run `make web-test`, `make web-lint`, `make web-assets-check`, and `uv build`
when preparing the SDK. The release stages a reproducible UI archive alongside
the Python distributions and built console, with checksums binding their bytes.
Only the Python distributions are uploaded to PyPI.

### Running a workflow

Once you have the operator running, you can either start workflows directly in the web UI, or start runs from your command line in a different terminal:

```bash
uv run ava run <workflow_name>
```

### TUI

Avalanche also ships with a Terminal UI, that you can launch on the operator:

```bash
uv run ava tui --connect localhost:7433
```

The operator defaults to port 7433.

### Workflow inputs

Avalanche supports passing inputs to workflows using the BaseInput class. Learn more in
[the DAG API&#39;s input and context guide](docs/dag-api.md#input-and-context). You can pass
inputs directly in the Web UI using small JSON editor, or through the command line:

```bash
uv run ava run <workflow_name> --input '{"key": "value"}'
```

### Embedded workflows

You can run a workflow directly from Python. `.run()` returns an awaitable `RunHandle`; call `.result()` to wait synchronously:

```python
run = feedback_workflow().run(executor=ava.LocalExecutor())
print(run.run_id)
result = run.result()
```

## Quick Example

```python
import random
import avalanche as ava

@ava.source
def generate_binary() -> str:
    length = random.randint(128, 256)
    return "1" + "".join(random.choice("01") for _ in range(length - 1))

@ava.agent_step(
    ava.Signature(
        "binary: str -> decimal: str",
    ),
    runtime=ava.runtimes.PredictRLM(lm="openai/gpt-5.6-terra"),
)
async def convert_binary(binary: str, *, agent: ava.Agent) -> str:
    return (await agent(binary=binary)).outputs.decimal

@ava.dest
def print_result(result: str) -> str:
    print(result)
    return result


@ava.workflow
def binary_converter():
    return generate_binary() >> convert_binary() >> print_result()
```

## Examples

The [`examples/`](examples/) directory contains runnable workflows. Start with
the customer feedback review, a production-shaped agentic data-transformation
workflow; the rest are focused pattern demos.

| Example                                                            | Description                                                                                                                                             |
| ------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [Customer feedback review](examples/customer_feedback_review/)      | End-to-end agentic workflow: parallel theme/risk analysis of a feedback workbook, deterministic reconciliation, and published Excel + Word review pack. |
| [`classifier_workflow.py`](examples/classifier_workflow.py) | TypeSafe Choice, Noul, and Score questions, typed answers, and current/historical classifier inspection in the operator UI. |
| [`classifier_provider_workflow.py`](examples/classifier_provider_workflow.py) | The same three question types answered by OpenAI Decisions or Gemini Decision when that key is set, else TypeSafe. |
| [`complex_dag_pattern.py`](examples/complex_dag_pattern.py)       | Local DAG API with explicit data passing, fan-out, and fan-in on`ava.LocalExecutor`.                                                                  |
| [`stream_pattern.py`](examples/stream_pattern.py)                 | Stream-based incremental processing with local Iceberg tables.                                                                                          |
| [`cursor_pattern.py`](examples/cursor_pattern.py)                 | Manual checkpoint control with cursors for advanced incremental flows.                                                                                  |
| [`document_file_workflow.py`](examples/document_file_workflow.py) | Typed`ava.File` inputs and outputs through a `BaseInput` workflow.                                                                                  |
| [`operator_workflow.py`](examples/operator_workflow.py)           | Flow file for the local operator and connected TUI path.                                                                                                |

See [`examples/README.md`](examples/README.md) for how to run each example.

## LLM providers and models

Avalanche sends agent-model requests through DSPy's native model engines, using
`provider/model` IDs such as `openai/gpt-5.5`, `anthropic/claude-sonnet-5`,
`gemini/gemini-3.5-flash`, or `moonshot/kimi-k3`. Avalanche does not install
LiteLLM. Set the provider's standard credential variable (for example
`OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, or `GEMINI_API_KEY`); the process running
the operator must have access to it.

Routes that DSPy serves only through LiteLLM (for example `bedrock/` or
`vertex_ai/`) need `dspy[litellm]` installed in your project. If you use uv, add
`exclude-dependencies = ["litellm"]` under `[tool.uv]` in your own project to keep
LiteLLM out, since DSPy still declares it as a dependency. Workspaces created by
`init.sh` include this exclusion; remove it before adding `dspy[litellm]`, because
uv drops excluded packages even when another requirement asks for them.

Agent settings live on the step's runtime, `ava.runtimes.PredictRLM(...)`: set
`lm` for the main model and `sub_lm` for the sub-model. Shared settings go on the
workflow's default runtime:

```python
@ava.workflow(
    agent_defaults={
        "runtime": ava.runtimes.PredictRLM(
            lm="openai/gpt-5.5", sub_lm="gemini/gemini-3.5-flash"
        )
    }
)
def feedback_workflow():
    return load_text() >> ava.agent.step(
        ava.Signature("text: str -> completion: str")
    )
```

A step's own `runtime=ava.runtimes.PredictRLM(...)` is merged over the workflow
default field by field, so a step sets only what differs. `agent_defaults` holds
only the runtime; signatures and tools remain defined on each agent step.

Classifier steps call a decision service directly, not DSPy: TypeSafe by default,
chosen with `classifier=ava.classifiers.TypeSafe()`, or OpenAI's Decisions API with
`classifier=ava.classifiers.OpenAIDecisions()` (the `openai` extra and `OPENAI_API_KEY`), or
Google's Gemini Decision with `classifier=ava.classifiers.GeminiDecision()` (the `gemini` extra
and `GEMINI_API_KEY`); see [choosing the provider](docs/classifier-steps.md#choosing-the-provider).
Set the key of the provider in use (`TYPESAFE_API_KEY` by default) in the
executing environment or your project's `.env` file; exported variables take precedence.
Choose `classifier`, `model` and `timeout` on `@ava.classifier_step` or in
`@ava.workflow(classifier_defaults={...})`. Step values override workflow values;
otherwise the defaults are TypeSafe, `jev-latest` and 10 seconds. No key is needed to
discover questions before running. Declare optional defaults with
`@ava.classifier_step(questions=...)`, or supply a complete runtime mapping with
`await classifier(state=..., questions=...)`; call questions replace, not merge
with, defaults. See [Classifier steps](docs/classifier-steps.md) for the full API,
probability semantics, and local evidence retention limits.

## Optional components

| Extra     | Purpose                       |
| --------- | ----------------------------- |
| `iceberg` | Iceberg storage backend (including local SQLite and S3/Glue support) |
| `lance`  | Lance storage backend         |
| `claude` | `ava.runtimes.ClaudeAgent`, which runs agent steps with Claude through the Claude Agent SDK; also needs the Claude Code CLI |
| `openai` | `ava.runtimes.OpenAIAgent`, which runs agent steps with OpenAI models through the OpenAI Agents SDK, and `ava.classifiers.OpenAIDecisions`, which answers classifier steps and evaluations with OpenAI's Decisions API |
| `gemini` | `ava.classifiers.GeminiDecision`, which answers classifier steps and evaluations with Google's Gemini Decision service through `google-genai`; needs `GEMINI_API_KEY` |

The extras can be combined:

```bash
uv add "avalanche-ai[iceberg,lance,claude,openai,gemini]"
```

## Documentation

- [DAG API](docs/dag-api.md)
- [State machines and native calls](docs/state-machines.md)
- [File references](docs/file-references.md)
- [Reruns](docs/api/reruns.md)
- [Agent steps](docs/agent-steps.md)
- [Classifier steps](docs/classifier-steps.md)
- [Integrations](docs/integrations.md)
- [Data model and storage API](docs/data-model-api.md)
- [Execution services](docs/execution-services.md)
- [Architecture](ARCHITECTURE.md)
- [Examples](examples/README.md)
- [Changelog](CHANGELOG.md)

## Contributing

Contributions are welcome. See [CONTRIBUTING.md](CONTRIBUTING.md) for local setup,
quality gates, and pull request expectations.

## License

Avalanche is licensed under the [MIT License](LICENSE).
