Skip to content

skitsanos/tiny-crew

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

64 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tiny Crew

TinyCrew is a TypeScript framework that orchestrates multiple AI agents to solve complex tasks collaboratively.

Features

  • Multi-Agent Orchestration - Specialized agents with distinct goals working together
  • Shared Memory - Knowledge transfer and persistence between agents
  • Tool Integration - Extensible system using OpenAI Responses API
  • Structured Output - Type-safe JSON responses with Zod schema validation
  • Conversation Management - Multi-turn history with automatic summarization
  • Response Streaming - Real-time response delivery
  • Agent Messaging - Direct agent-to-agent communication
  • Multi-Model Routing - Cost optimization with purpose-based model selection
  • Event System - Comprehensive monitoring and hooks

Quick Start

Installation

git clone https://github.com/skitsanos/tiny-crew.git
cd tiny-crew
bun install

Configuration

Create a .env file:

OPENAI_API_KEY=your_api_key_here
DEFAULT_MODEL=gpt-4o

Basic Example

import { Crew, Agent } from 'tiny-crew';
import OpenAI from 'openai';

const openai = new OpenAI();

// Create a crew with a goal
const crew = new Crew({ goal: 'Research and summarize AI trends' }, openai);

// Add specialized agents
crew.addAgent(new Agent({
    name: 'Researcher',
    goal: 'Find and analyze information',
    capabilities: ['research', 'analysis']
}, openai));

crew.addAgent(new Agent({
    name: 'Writer',
    goal: 'Create clear summaries',
    capabilities: ['writing', 'summarization']
}, openai));

// Add tasks and execute
crew.addTask('Research recent AI breakthroughs');
crew.addTask('Summarize findings in 3 bullet points');

await crew.executeAllTasks();
const summary = await crew.achieveCrewGoal();

Simple Agent Conversation

const agent = new Agent({
    name: 'Assistant',
    goal: 'Help users with questions'
}, openai);

// Conversations maintain history automatically
const response = await agent.chat('Hello!');
const followUp = await agent.chat('What can you help me with?');

Documentation

Full documentation is available in the docs/ folder:

Guide Description
Getting Started Installation, configuration, and first steps
Memory System Knowledge sharing between agents
Multi-Model Routing Cost optimization with model routing
Conversation History Multi-turn conversations and summarization
Response Streaming Real-time response streaming
Agent Messaging Agent-to-agent communication
Structured Output Type-safe JSON responses with Zod schemas
Memory Tools Tools for agent memory management
Custom Tools Creating your own tools
Advanced Patterns Persona agents, behavioral modeling, structured protocols
Testing Guide Mock clients and testing patterns
Use Cases Practical implementation scenarios

Examples

The examples/ directory contains ready-to-run examples:

bun run examples/WebResearcher.ts
bun run examples/CreativeWriter.ts
bun run examples/PersistentMemory.ts

Requirements

  • Bun (v1.2.x+) or Node.js (v22+)
  • TypeScript
  • OpenAI API key

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT License

About

Multi-Agent AI system to tackle complex tasks through intelligent collaboration

Topics

Resources

Stars

Watchers

Forks

Contributors