Skip to content

distrihub/distri

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

382 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Distri

Distri is an open-source AI agent framework built in Rust. Define agents in markdown, connect your product functions as tools, and run them from the CLI, as an API server, or embedded in your React UI.

Documentation · Website · Distri Cloud

Distri Dashboard


Why Distri

  • Agents as markdown — Define behavior, tools, and model settings in a single .md file with TOML frontmatter
  • Built-in tool system — Builtins (search, shell, browser), dynamic HTTP tools, external client-side tools, and MCP support
  • Skills — On-demand knowledge documents agents load at runtime via load_skill, with automatic re-injection after context compaction
  • Sub-agents — Agents delegate to specialized child agents with isolated context and token budgets
  • Remote execution — Run agents in sandboxed containers for untrusted code or resource isolation
  • React SDK — Drop-in <Chat /> component with streaming, tool renderers, voice, and developer mode
  • A2A compatible — Implements the A2A protocol for agent discovery and invocation
  • Self-hosted — Run on your own infrastructure with SQLite. No external dependencies required.

Installation

# Install script (macOS / Linux)
curl -fsSL https://distri.dev/install.sh | sh

# Homebrew
brew tap distrihub/distri && brew install distri

# Verify
distri --version
Other platforms

Direct download:

# darwin-arm64 | darwin-x86_64 | linux-arm64 | linux-x86_64
TARGET=darwin-arm64
curl -L "https://github.com/distrihub/distri/releases/latest/download/distri-${TARGET}.tar.gz" -o distri.tar.gz
sudo tar -xzf distri.tar.gz -C /usr/local/bin distri

Windows (PowerShell):

Invoke-WebRequest https://github.com/distrihub/distri/releases/latest/download/distri-windows-x86_64.zip -OutFile distri.zip
Expand-Archive distri.zip -DestinationPath $Env:LOCALAPPDATA\distri -Force
$Env:Path += ";$Env:LOCALAPPDATA\distri"

Quick Start

Run a built-in agent

distri run search --task "What are the top programming languages in 2026?"

Define your own agent

Create agents/my_agent.md:

---
name = "my_agent"
description = "A helpful assistant with web search"
max_iterations = 15

[tools]
builtin = ["final", "search"]
---

# My Agent

You are a helpful assistant. Use the search tool to find current information.

{{task}}

Run it

# Interactive chat
distri tui my_agent

# Single task
distri run --agent my_agent --task "Find the latest SpaceX launch date"

# Start as API server
distri serve --port 8080

Push to Distri Cloud

distri login
distri agents push agents/my_agent.md

Built-in Agents

Agent Purpose Example
search Web search + scrape distri run search --task "latest AI news"
fast_search Quick single-query lookups distri run fast_search --task "population of Tokyo"
web Browser automation + scraping distri run web --task "scrape HN top 5 stories"
code Sandboxed code execution distri run code --task "sum of primes below 1000"
deepresearch Multi-phase research with sub-agent delegation distri run deepresearch --task "state of quantum computing"
distri Master orchestrator distri run distri --task "find and calculate..."
coder Full coding agent (shell + web + files) distri run coder --task "build a REST API"
agent_designer Design new agent definitions distri run agent_designer --task "design a stock alert agent"

Requires BROWSR_BASE_URL and BROWSR_API_KEY for search, browser, and shell tools. Configured automatically on Distri Cloud.


Agent Definition Format

Agents are markdown files with TOML frontmatter:

---
name = "my_agent"
description = "What this agent does"
max_iterations = 25
context_size = 80000
sub_agents = ["search", "code"]     # delegate to other agents

[tools]
builtin = ["final", "search", "load_skill"]
external = ["Read", "Write", "Edit"]  # client-side tools

[[tools.dynamic]]
name = "my_api"
type = "http"
description = "Call my API"
config = { base_url = "$API_URL", headers = { "Authorization" = "Bearer $TOKEN" } }

[[available_skills]]
id = "*"
name = "*"
---

# System Prompt

Your instructions here. Supports Handlebars templates:
- {{task}} — the user's message
- {{> skills}} — available skills listing
- {{> connections}} — available connections

See Agent Definition docs for the full schema.


Skills

Skills are reusable instruction documents agents load on demand:

---
name = "data_pipeline"
description = "How to run the data transformation pipeline"
tags = ["data", "etl"]
context = "inline"
---

# Data Pipeline

## Steps
1. Fetch data with `my_api` tool...
2. Transform using Python...
# Push skills
distri skills push skills/data_pipeline.md
distri skills list

Agents call load_skill("data_pipeline") at runtime. Two modes:

  • Inline (default) — content injected into conversation, survives context compaction
  • Fork — spawns isolated child agent with skill as instructions

React SDK (DistriJS)

Embed agents in your React app:

npm install @distri/react
import { useAgent, Chat } from '@distri/react';

function App() {
  const { agent } = useAgent({ agentIdOrDef: 'my_agent' });
  return <Chat agent={agent} threadId="conversation-1" />;
}

Features: SSE streaming, tool execution with custom renderers, voice I/O, developer mode, browser-side file tools (IndexedDB-backed Read/Write/Edit/Glob/Grep).

See the DistriJS docs for full integration guide.


CLI Reference

distri                              # Interactive TUI
distri run --task "..." [--agent A] # Run a task
distri run --task "..." --remote    # Run in sandboxed container

distri agents list / push / delete  # Manage agents
distri skills list [-a] / push      # Manage skills
distri traces list / show ID [-v]   # Debug with trace viewer
distri tools list / invoke          # Inspect and test tools

distri connections list / token     # OAuth connections
distri secrets list / set / delete  # Manage secrets
distri workflows run / push         # DAG workflows

distri serve --port 8080            # Start API server
distri login                        # Auth with Distri Cloud
distri profile list / use / config  # Multi-profile management

Architecture

distri/
├── distri-types/          # Shared type definitions
├── distri-cli/            # CLI binary
├── distri/                # Client library
├── distri-formatter/      # Output formatting
│
├── server/
│   ├── distri-core/       # Agent engine (orchestrator, loop, tools, LLM)
│   ├── distri-server/     # HTTP server (actix-web, A2A endpoints)
│   ├── distri-stores/     # Storage backends (SQLite, Postgres)
│   ├── distri-auth/       # Auth providers
│   ├── distri-parsers/    # Parsing utilities
│   └── agents/            # Built-in agent definitions (.md)
│
├── distrijs/              # TypeScript SDK
│   ├── @distri/core       # Agent client, A2A streaming
│   ├── @distri/react      # React hooks, Chat component, browser tools
│   └── @distri/components # Shared UI (shadcn/ui)
│
└── samples/               # Example applications
    ├── maps-demo/         # Google Maps + AI chat
    └── scraper/           # Web scraping agent

Execution Flow

User message → AgentOrchestrator
  → Load agent definition
  → Create ExecutorContext (thread, task, run)
  → AgentLoop
    → PlanningStrategy.plan() → LLM produces plan
    → ExecutionStrategy.execute_step() per step
      → Tool calls (builtin, dynamic, external, MCP)
      → Event streaming (SSE)
    → Loop until final tool or max iterations
  → Return result

Development

# Build
cargo build

# Run tests
cargo test

# Test a specific crate
cargo test -p distri-core

# DistriJS development
cd distrijs && pnpm install && pnpm dev

Samples

Sample Type Description
maps-demo React/Vite Interactive Google Maps with AI chat
scraper CLI/Rust Web scraping and data extraction agent

Licensing


Links

About

Distri is A2A compatible OpenClaw like agent framework built in Rust.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors