Skip to content

TinyAGI/tinyagi

Repository files navigation

TinyAGI

TinyAGI 🦞

Multi-agent, Multi-team, Multi-channel, 24/7 AI assistant

Run multiple teams of AI agents that collaborate with each other simultaneously with isolated workspaces.

Experimental MIT License Discord Latest Release

tinyclaw.mp4

✨ Features

  • βœ… Multi-agent - Run multiple isolated AI agents with specialized roles
  • βœ… Multi-team collaboration - Agents hand off work to teammates via chain execution and fan-out
  • βœ… Multi-channel - Discord, WhatsApp, and Telegram
  • βœ… Web portal (TinyOffice) - Browser-based dashboard for chat, agents, teams, tasks, logs, and settings
  • βœ… Team chat rooms - Persistent async chat rooms per team with real-time CLI viewer
  • βœ… Multiple AI providers - Anthropic Claude, OpenAI Codex, and custom providers (any OpenAI/Anthropic-compatible endpoint)
  • βœ… Auth token management - Store API keys per provider, no separate CLI auth needed
  • βœ… Parallel processing - Agents process messages concurrently
  • βœ… Live TUI dashboard - Real-time team visualizer and chatroom viewer
  • βœ… Persistent sessions - Conversation context maintained across restarts
  • βœ… SQLite queue - Atomic transactions, retry logic, dead-letter management
  • βœ… Plugin system - Extend TinyAGI with custom plugins for message hooks and event listeners
  • βœ… 24/7 operation - Runs in tmux for always-on availability

Community

Discord

We are actively looking for contributors. Please reach out.

πŸš€ Quick Start

Prerequisites

  • macOS, Linux and Windows (WSL2)
  • Node.js v18+
  • tmux, jq
  • Bash 3.2+
  • Claude Code CLI (for Anthropic provider)
  • Codex CLI (for OpenAI provider)

Installation & First Run

curl -fsSL https://raw.githubusercontent.com/TinyAGI/tinyagi/main/scripts/install.sh | bash

This downloads and installs the tinyagi command globally. Then start it:

tinyagi start

The setup wizard will guide you through channel selection, bot tokens, workspace setup, and AI provider configuration.

Other installation methods

From Source:

git clone https://github.com/TinyAGI/tinyagi.git
cd tinyagi && npm install && ./scripts/install.sh

Web-based setup (skip CLI wizard):

tinyagi start --skip-setup  # Starts API server only
# Then open https://office.tinyagicompany.com or run: tinyagi office
# After setup, channels start automatically

The setup wizard (CLI or web) will also guide you through default agent, AI provider, model selection, and heartbeat interval.

πŸ“± Channel Setup Guides

Discord Setup

  1. Go to Discord Developer Portal
  2. Create application β†’ Bot section β†’ Create bot
  3. Copy bot token
  4. Enable "Message Content Intent"
  5. Invite bot using OAuth2 URL Generator

Telegram Setup

  1. Open Telegram β†’ Search @BotFather
  2. Send /newbot β†’ Follow prompts
  3. Copy bot token
  4. Start chat with your bot

WhatsApp Setup

After starting TinyAGI, scan the QR code:

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
     WhatsApp QR Code
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
[QR CODE HERE]

πŸ“± Settings β†’ Linked Devices β†’ Link a Device

🌐 TinyOffice Web Portal

TinyAGI includes a web portal for managing your agents, teams, tasks, and chat β€” all from the browser.

TinyOffice Office View

Once you start running TinyAGI locally, you can control it by visiting office.tinyagicompany.com. It connects to your local TinyAGI API at localhost:3777 β€” no account or sign-up needed.

Alternatively, you can run TinyOffice locally:

tinyagi office  # Builds and starts on http://localhost:3000
TinyOffice Features & Setup
  • Dashboard - Real-time queue/system overview and live event feed
  • Chat Console - Send messages to default agent, @agent, or @team
  • Agents & Teams - Create, edit, and remove agents/teams
  • Tasks (Kanban) - Create tasks, drag across stages, assign to agent/team
  • Logs & Events - Inspect queue logs and streaming events
  • Settings - Edit TinyAGI configuration (settings.json) via UI
  • Office View - Visual simulation of agent interactions
  • Org Chart - Hierarchical visualization of teams and agents
  • Chat Rooms - Slack-style persistent chat rooms per team
  • Projects - Project-level task management with filtered kanban boards

Running Locally

Start TinyAGI first (API default: http://localhost:3777), then:

tinyagi office

This auto-detects when dependencies or builds are needed (e.g. after tinyagi update) and starts the production server on http://localhost:3000.

For development with hot-reload:

cd tinyoffice
npm install
npm run dev

If TinyAGI API is on a different host/port, set:

cd tinyoffice
echo 'NEXT_PUBLIC_API_URL=http://localhost:3777' > .env.local

πŸ“‹ Commands

Commands work with tinyagi (primary CLI) or tinyagi (backward compatible alias).

Core Commands

Command Description Example
start [--skip-setup] Start TinyAGI daemon (--skip-setup: API only, setup via web) tinyagi start
stop Stop all processes tinyagi stop
restart Restart TinyAGI tinyagi restart
status Show current status and activity tinyagi status
setup Run setup wizard (reconfigure) tinyagi setup
logs [type] View logs (discord/telegram/whatsapp/queue/heartbeat/all) tinyagi logs queue
attach Attach to tmux session tinyagi attach

Agent Commands

Command Description Example
agent list List all configured agents tinyagi agent list
agent add Add new agent (interactive) tinyagi agent add
agent show <id> Show agent configuration tinyagi agent show coder
agent remove <id> Remove an agent tinyagi agent remove coder
agent reset <id> Reset agent conversation tinyagi agent reset coder
agent provider <id> [provider] Show or set agent's AI provider tinyagi agent provider coder anthropic
agent provider <id> <p> --model <m> Set agent's provider and model tinyagi agent provider coder openai --model gpt-5.3-codex

Team Commands

Command Description Example
team list List all configured teams tinyagi team list
team add Add new team (interactive) tinyagi team add
team show <id> Show team configuration tinyagi team show dev
team remove <id> Remove a team tinyagi team remove dev
team add-agent <t> <a> Add an existing agent to a team tinyagi team add-agent dev reviewer
team remove-agent <t> <a> Remove an agent from a team tinyagi team remove-agent dev reviewer
team visualize [id] Live TUI dashboard for team chains tinyagi team visualize dev

Chatroom Commands

Command Description Example
chatroom <team> Real-time TUI viewer with type-to-send tinyagi chatroom dev
office Start TinyOffice web portal on port 3000 tinyagi office

Every team has a persistent chat room. Agents post to it using [#team_id: message] tags, and messages are broadcast to all teammates. The chatroom viewer polls for new messages in real time β€” type a message and press Enter to post, or press q/Esc to quit.

API endpoints:

GET  /api/chatroom/:teamId          # Get messages (?limit=100&since=0)
POST /api/chatroom/:teamId          # Post a message (body: { "message": "..." })

Provider & Custom Provider Commands

Command Description Example
provider [name] Show or switch global AI provider tinyagi provider anthropic
provider <name> --model <model> Switch provider and model; propagates to matching agents tinyagi provider openai --model gpt-5.3-codex
provider <name> --auth-token <key> Store API key for a built-in provider tinyagi provider anthropic --auth-token sk-...
provider list List all custom providers tinyagi provider list
provider add Add a new custom provider (interactive) tinyagi provider add
provider remove <id> Remove a custom provider tinyagi provider remove proxy
model [name] Show or switch AI model tinyagi model opus
Custom provider details

Custom providers let you use any OpenAI or Anthropic-compatible API endpoint (e.g., OpenRouter, proxy servers, self-hosted models).

Define a custom provider in settings.json:

{
  "custom_providers": {
    "my-proxy": {
      "name": "My Proxy",
      "harness": "claude",
      "base_url": "https://proxy.example.com/v1",
      "api_key": "sk-...",
      "model": "claude-sonnet-4-6"
    }
  }
}
Field Required Description
name Yes Human-readable display name
harness Yes CLI to use: claude or codex
base_url Yes API endpoint URL
api_key Yes API key for authentication
model No Default model name for CLI

Assign a custom provider to an agent:

tinyagi agent provider coder custom:my-proxy
tinyagi agent provider coder custom:my-proxy --model gpt-4o

Auth token storage β€” store API keys for built-in providers so you don't need separate CLI auth:

tinyagi provider anthropic --auth-token sk-ant-...
tinyagi provider openai --auth-token sk-...

Tokens are saved in settings.json under models.<provider>.auth_token and automatically exported as ANTHROPIC_API_KEY / OPENAI_API_KEY when invoking CLIs.

API endpoints:

GET    /api/custom-providers              # List custom providers
PUT    /api/custom-providers/:id          # Create or update
DELETE /api/custom-providers/:id          # Delete

See docs/AGENTS.md for more details.

Pairing commands

Use sender pairing to control who can message your agents.

Command Description Example
pairing pending Show pending sender approvals (with pairing codes) tinyagi pairing pending
pairing approved Show approved senders tinyagi pairing approved
pairing list Show both pending and approved senders tinyagi pairing list
pairing approve <code> Move a sender from pending to approved by code tinyagi pairing approve ABCD1234
pairing unpair <channel> <sender_id> Remove an approved sender from the allowlist tinyagi pairing unpair telegram 1234567

Pairing behavior:

  • First message from unknown sender: TinyAGI generates a code and sends approval instructions.
  • Additional messages while still pending: TinyAGI blocks silently (no repeated pairing message).
  • After approval: messages from that sender are processed normally.
Messaging & in-chat commands
Command Description Example
send <message> Send message to AI manually tinyagi send "Hello!"
send <message> Route to specific agent tinyagi send "@coder fix bug"

These commands work in Discord, Telegram, and WhatsApp:

Command Description Example
@agent_id message Route message to specific agent @coder fix the bug
@team_id message Route message to team leader @dev fix the auth bug
/agent List all available agents /agent
/team List all available teams /team
@agent_id /reset Reset specific agent conversation @coder /reset
/reset Reset conversation (WhatsApp/global) /reset or !reset
/restart Restart TinyAGI process /restart
message Send to default agent (no prefix) help me with this

Note: The @agent_id routing prefix requires a space after it (e.g., @coder fix not @coderfix).

Access control note: before routing, channel clients apply sender pairing allowlist checks.

Update commands
Command Description Example
update Update TinyAGI to latest version tinyagi update

Note: If you are on v0.0.1 or v0.0.2, the update script was broken. Please re-install instead:

curl -fsSL https://raw.githubusercontent.com/TinyAGI/tinyagi/main/scripts/install.sh | bash

Your settings and user data will be preserved.

Auto-detection: TinyAGI checks for updates on startup (once per hour).

Disable update checks:

export TINYAGI_SKIP_UPDATE_CHECK=1
Configuration commands
Command Description Example
reset Reset all conversations tinyagi reset
channels reset <chan> Reset channel authentication tinyagi channels reset whatsapp

πŸ€– Using Agents

Use @agent_id prefix to route messages to specific agents:

@coder fix the authentication bug
@writer document the API endpoints
help me with this  ← goes to default agent (no prefix needed)
Agent configuration

Agents are configured in .tinyagi/settings.json:

{
  "agents": {
    "coder": {
      "name": "Code Assistant",
      "provider": "anthropic",
      "model": "sonnet",
      "working_directory": "/Users/me/tinyagi-workspace/coder"
    },
    "writer": {
      "name": "Technical Writer",
      "provider": "custom:my-proxy",
      "model": "gpt-5.3-codex",
      "working_directory": "/Users/me/tinyagi-workspace/writer"
    }
  }
}

Each agent operates in isolation:

  • Separate workspace directory - ~/tinyagi-workspace/{agent_id}/
  • Own conversation history - Maintained by CLI
  • Custom configuration - .claude/, heartbeat.md (root), AGENTS.md
  • Independent resets - Reset individual agent conversations

See docs/AGENTS.md for full details on architecture, use cases, and advanced features.

πŸ“ Architecture

Message flow diagram
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                     Message Channels                         β”‚
β”‚         (Discord, Telegram, WhatsApp, Web, API)             β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                     β”‚ enqueueMessage()
                     ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚               ~/.tinyagi/tinyagi.db (SQLite)               β”‚
β”‚                                                              β”‚
β”‚  messages: pending β†’ processing β†’ completed / dead          β”‚
β”‚  responses: pending β†’ acked                                  β”‚
β”‚                                                              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                     β”‚ Queue Processor
                     ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              Parallel Processing by Agent                    β”‚
β”‚                                                              β”‚
β”‚  Agent: coder        Agent: writer       Agent: assistant   β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”       β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”       β”‚
β”‚  β”‚ Message 1β”‚       β”‚ Message 1β”‚        β”‚ Message 1β”‚       β”‚
β”‚  β”‚ Message 2β”‚ ...   β”‚ Message 2β”‚  ...   β”‚ Message 2β”‚ ...   β”‚
β”‚  β”‚ Message 3β”‚       β”‚          β”‚        β”‚          β”‚       β”‚
β”‚  β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜       β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜        β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜       β”‚
β”‚       β”‚                  β”‚                     β”‚            β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
        ↓                  ↓                     ↓
   claude CLI         claude CLI             claude CLI
  (workspace/coder)  (workspace/writer)  (workspace/assistant)

Key features:

  • SQLite queue - Atomic transactions via WAL mode, no race conditions
  • Parallel agents - Different agents process messages concurrently
  • Sequential per agent - Preserves conversation order within each agent
  • Retry & dead-letter - Failed messages retry up to 5 times, then enter dead-letter queue
  • Isolated workspaces - Each agent has its own directory and context

See docs/QUEUE.md for detailed queue system documentation.

βš™οΈ Configuration

Settings file reference

Located at .tinyagi/settings.json:

{
  "channels": {
    "enabled": ["discord", "telegram", "whatsapp"],
    "discord": { "bot_token": "..." },
    "telegram": { "bot_token": "..." },
    "whatsapp": {}
  },
  "workspace": {
    "path": "/Users/me/tinyagi-workspace",
    "name": "tinyagi-workspace"
  },
  "agents": {
    "assistant": {
      "name": "Assistant",
      "provider": "anthropic",
      "model": "sonnet",
      "working_directory": "/Users/me/tinyagi-workspace/assistant"
    }
  },
  "teams": {
    "dev": {
      "name": "Development Team",
      "agents": ["coder", "reviewer"],
      "leader_agent": "coder"
    }
  },
  "custom_providers": {
    "my-proxy": {
      "name": "My Proxy",
      "harness": "claude",
      "base_url": "https://proxy.example.com/v1",
      "api_key": "sk-...",
      "model": "claude-sonnet-4-6"
    }
  },
  "models": {
    "anthropic": { "auth_token": "sk-ant-..." },
    "openai": { "auth_token": "sk-..." }
  },
  "monitoring": {
    "heartbeat_interval": 3600
  }
}
Heartbeat configuration

Edit agent-specific heartbeat prompts:

nano ~/tinyagi-workspace/coder/heartbeat.md

Default heartbeat prompt:

Check for:

1. Pending tasks
2. Errors
3. Unread messages

Take action if needed.
Directory structure
tinyagi/
β”œβ”€β”€ packages/                # Monorepo packages
β”‚   β”œβ”€β”€ core/                #   Shared types, config, queue, agent invocation
β”‚   β”œβ”€β”€ main/                #   Queue processor entry point
β”‚   β”œβ”€β”€ teams/               #   Team conversation orchestration
β”‚   β”œβ”€β”€ server/              #   API server (REST + SSE)
β”‚   β”œβ”€β”€ channels/            #   Channel clients (Discord, Telegram, WhatsApp)
β”‚   β”œβ”€β”€ cli/                 #   CLI commands (tinyagi.sh helpers)
β”‚   └── visualizer/          #   TUI dashboard and chatroom viewer
β”œβ”€β”€ tinyoffice/              # TinyOffice web portal (Next.js)
β”œβ”€β”€ .tinyagi/               # TinyAGI data (created at runtime)
β”‚   β”œβ”€β”€ settings.json        #   Configuration
β”‚   β”œβ”€β”€ tinyagi.db          #   SQLite queue database
β”‚   β”œβ”€β”€ logs/                #   All logs
β”‚   β”œβ”€β”€ channels/            #   Channel state
β”‚   β”œβ”€β”€ files/               #   Uploaded files
β”‚   β”œβ”€β”€ pairing.json         #   Sender allowlist state
β”‚   β”œβ”€β”€ chats/               #   Team conversation history
β”‚   β”‚   └── {team_id}/       #     Per-team chat logs
β”‚   β”œβ”€β”€ .claude/             #   Template for agents
β”‚   β”œβ”€β”€ heartbeat.md         #   Template for agents
β”‚   └── AGENTS.md            #   Template for agents
β”œβ”€β”€ ~/tinyagi-workspace/    # Agent workspaces
β”‚   β”œβ”€β”€ coder/
β”‚   β”œβ”€β”€ writer/
β”‚   └── assistant/
β”œβ”€β”€ lib/                     # Runtime scripts
β”œβ”€β”€ scripts/                 # Installation scripts
└── tinyagi.sh              # Main script

🎯 Use Cases

Examples

Personal AI Assistant

You: "Remind me to call mom"
Claude: "I'll remind you!"
[1 hour later via heartbeat]
Claude: "Don't forget to call mom!"

Multi-Agent Workflow

@coder Review and fix bugs in auth.ts
@writer Document the changes
@reviewer Check the documentation quality

Team Collaboration

@dev fix the auth bug
# β†’ Routes to team leader (@coder)
# β†’ Coder fixes bug, mentions @reviewer in response
# β†’ Reviewer automatically invoked, reviews changes
# β†’ Combined response sent back to user

Teams support sequential chains (single handoff) and parallel fan-out (multiple teammate mentions). See docs/TEAMS.md for details.

Cross-Device Access

  • WhatsApp on phone, Discord on desktop, Telegram anywhere, CLI for automation
  • All channels share agent conversations!

πŸ“š Documentation

πŸ› Troubleshooting

Quick fixes & common issues
# Reset everything (preserves settings)
tinyagi stop && rm -rf .tinyagi/queue/* && tinyagi start

# Reset WhatsApp
tinyagi channels reset whatsapp

# Check status
tinyagi status

# View logs
tinyagi logs all

Common issues:

  • WhatsApp not connecting β†’ Reset auth: tinyagi channels reset whatsapp
  • Messages stuck β†’ Clear queue: rm -rf .tinyagi/queue/processing/*
  • Agent not found β†’ Check: tinyagi agent list
  • Corrupted settings.json β†’ TinyAGI auto-repairs invalid JSON (trailing commas, comments, BOM) and creates a .bak backup

Need help? GitHub Issues Β· tinyagi logs all

πŸ™ Credits

πŸ“„ License

MIT


TinyAGI - Tiny but mighty! 🦞✨

Star History Chart