Skip to main content

Getting Started

Distri lets you define an agent once in a markdown file and reach it from the CLI, an API, or embedded in your product. This page installs the CLI, signs you in, applies a sample agent and runs it, then shows how to write your own.

By default the CLI connects to Distri Cloud at api.distri.dev, so there's no infrastructure to stand up. Prefer to run everything on your own machine? See Run Distri locally.


1. Install the CLI​

curl -fsSL https://distri.dev/install.sh | sh
distri --version

The installer downloads a prebuilt binary for macOS and Linux (x86_64 / arm64). On other platforms it offers to build from source with Cargo (installing Rust first if needed), and asks before doing either. Pass -y for a non-interactive install. Installation lists every flag and environment variable.

2. Log in​

distri login

The CLI opens your browser at app.distri.dev. Sign in with the one-time code sent to your email, pick or name a workspace, and click Authorize CLI. The terminal then prints ✓ Successfully authenticated! with the profile, a masked API key and the workspace id.

3. Apply the hello-world sample​

The hello-world sample is one agent (hello) and a one-step workflow (say_hello) that asks it for a greeting. Apply it to check that your install, your workspace and your model work. From a checkout of distrihub/distri:

distri apply samples/hello-world --set name=Ada --test

apply prints what it created, with a dashboard link for each, and runs the sample's test (links trimmed):

Hello world: Ready.

created agent hello …/agents/hello
created workflow say_hello …/agents/say_hello

Then: distri apply … --test → The run completes and steps.greet.output holds the agent's greeting
Running the test…
✓ Test run finished. Expect: The run completes and steps.greet.output holds the agent's greeting

If your workspace has no model yet, apply says so under To finish and the test fails with No model configured until you pick one (links trimmed):

To finish:
• Choose a default model
The agents answer with the workspace's default model.
…/gateway/models

Open the link, choose a model (or add a provider key there), and run the apply command again.

4. Run it​

distri run --agent hello --task "Say hello to Ada"

distri run streams the agent's reply to your terminal. Or drop into the interactive TUI to chat and switch between agents:

distri

Other samples, like docs-agent (a docs agent in a React portal) and customer-service (a support agent with Telegram escalation), apply the same way.

5. Write your own agent​

An agent is a markdown file with a TOML frontmatter block. Create agents/assistant.md:

---
name = "assistant"
description = "A concise, helpful assistant"
max_iterations = 3

[tools]
builtin = ["final"]

[model_settings]
model = "gpt-4.1-mini"
---

# ROLE
You are a concise, helpful assistant. Answer clearly and get to the point.

That's the whole agent: who it is (# ROLE), what it can do ([tools]), and which model runs it ([model_settings]). The final built-in lets it return an answer.

Set your model key

Distri uses your model provider key. Export it before running:

export OPENAI_API_KEY="sk-..."

6. Push it to your workspace​

You are already logged in. For CI or a scripted setup, skip the login and set your workspace credentials in the environment instead. A .env file works well:

# .env
DISTRI_API_KEY=dak_your_key
DISTRI_WORKSPACE_ID=your-workspace-id
# DISTRI_BASE_URL defaults to https://api.distri.dev/v1

Then push the whole project tree:

distri push          # syncs agents/, skills/, and templates/

Your agent now lives in your workspace, ready to run or call from a product.

7. Run your agent​

distri run --task "Explain what an AI agent is, in two sentences." --agent assistant

That's a working agent. Everything else, like tools and embedding, builds on this same file.


(Optional) Teach your coding agent​

If you build with Claude Code, Cursor, or Codex, install the Distri skill so your agent writes correct distri commands for you:

curl -fsSL https://distri.dev/skills/install.sh | sh

See Distri skill for coding agents.


Next: give it your product's tools​

The main use case for Distri is giving an agent your product's own functions as tools, so it can act inside your app: fill a form, update a grid, drive the page. From there, embed a streaming chat with a few lines of React or Angular.


Distri is open source under the MIT licence and free to self-host. The source and license are on GitHub.