Skip to content

amscotti/dart-agent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dart Agent

A proof-of-concept multi-agent research assistant built with Dart, demonstrating LLM agent orchestration using Dart Isolates for true parallelism.

asciicast

Features

  • Multi-agent Architecture: A supervisor agent decomposes complex queries into sub-tasks, spawning worker agents to research them in parallel
  • Dart Isolates: Each worker agent runs in its own isolate, enabling true parallelism with message passing for communication
  • MCP Integration: Workers use Model Context Protocol (MCP) servers for web search (Brave Search, Tavily) and page fetching
  • Terminal UI: Built with Nocterm, providing a Flutter-like development experience for terminal applications

Architecture

┌──────────────────────────────────────────────────────────────┐
│                     Main Thread                              │
│  ┌─────────────┐    ┌──────────────┐    ┌───────────────┐    │
│  │ Nocterm UI  │◄──►│  Supervisor  │◄──►│   Agent       │    │
│  │             │    │    Agent     │    │  Controller   │    │
│  └─────────────┘    └──────────────┘    └───────┬───────┘    │
└─────────────────────────────────────────────────┼────────────┘
                                                  │ SendPort/ReceivePort
                           ┌──────────────────────┼──────────────────────┐
                           │                      │                      │
                   ┌───────▼───────┐      ┌───────▼───────┐      ┌───────▼───────┐
                   │    Worker     │      │    Worker     │      │    Worker     │
                   │   Isolate 1   │      │   Isolate 2   │      │   Isolate N   │
                   │               │      │               │      │               │
                   │ ┌───────────┐ │      │ ┌───────────┐ │      │ ┌───────────┐ │
                   │ │    MCP    │ │      │ │    MCP    │ │      │ │    MCP    │ │
                   │ │  Servers  │ │      │ │  Servers  │ │      │ │  Servers  │ │
                   │ └───────────┘ │      │ └───────────┘ │      │ └───────────┘ │
                   └───────────────┘      └───────────────┘      └───────────────┘

Key Components

  • SupervisorAgent: Orchestrates the research workflow - decomposes queries, spawns workers, synthesizes results
  • AgentController: Manages isolate lifecycle and message passing between main thread and workers
  • Worker Agents: Run in separate isolates, each with their own MCP server connections for tool access
  • Nocterm UI: Real-time visualization of worker status with animated indicators

Prerequisites

  • Dart SDK 3.10 or higher
  • Node.js (required for Brave Search and Tavily MCP servers)
  • Python 3 with uvx (required for the Fetch MCP server)
  • API Keys:
    • ANTHROPIC_API_KEY (required) - for Claude LLM
    • BRAVE_API_KEY and/or TAVILY_API_KEY (at least one for web search)

Setup

  1. Clone and install dependencies:

    git clone https://github.com/amscotti/dart-agent.git
    cd dart-agent
    dart pub get
  2. Create a .env file with your API keys:

    ANTHROPIC_API_KEY=your-anthropic-key
    BRAVE_API_KEY=your-brave-key
    TAVILY_API_KEY=your-tavily-key
    
  3. Run the application:

    dart run

Usage

  1. Enter your research question in the search box
  2. Watch as the supervisor decomposes your query and spawns workers
  3. Monitor worker progress in real-time (animated status indicators)
  4. View the synthesized answer when research is complete

Keyboard Shortcuts

Key Action
Enter Submit query
/ Scroll through results
s Save output to markdown file
n Start new search
q Quit application

Development

# Run tests
dart test

# Format code
dart format .

# Analyze code
dart analyze .

Dependencies

License

MIT License - see LICENSE for details.

About

A proof-of-concept multi-agent research assistant built with Dart, demonstrating LLM agent orchestration using Dart Isolates for true parallelism.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages