This guide covers installation, configuration, and your first TinyCrew application.
- Bun (v1.2.x or newer) or Node.js (v22+)
- TypeScript
- OpenAI API key (uses OpenAI Responses API)
git clone https://github.com/skitsanos/tiny-crew.git
cd tiny-crewUsing npm:
npm installOr using Bun:
bun installCreate a .env file in the root directory:
OPENAI_API_KEY=your_api_key_here
DEFAULT_MODEL=gpt-4o
LOG_LEVEL=INFO
LOG_DUAL_OUTPUT=false
LOG_JSON_STREAM=stdoutTinyCrew ships with a flexible logger that works in both Bun and Node runtimes. By default it prints colorized text logs, but you can mirror structured JSON alongside them for ingestion into log pipelines:
| Variable | Description | Default |
|---|---|---|
LOG_LEVEL |
Log level (DEBUG, INFO, WARN, ERROR, FATAL) | INFO |
LOG_DUAL_OUTPUT |
Emit both text and JSON logs | false |
LOG_JSON_STREAM |
Where to write JSON logs (stdout, stderr) | stdout |
LOG_OUTPUT_FORMAT |
Switch entirely to JSON-only logging | text |
LOG_COLORIZE |
Enable/disable ANSI colors | true |
All options can also be overridden programmatically:
import Logger from './utils/logger';
const logger = new Logger('MyApp', {
level: 'DEBUG',
colorize: true,
jsonStream: 'stderr'
});Here's a minimal example to get you started:
import { Crew } from './Crew';
import { Agent } from './Agent';
import OpenAI from 'openai';
async function main() {
// Configure OpenAI client
const openai = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });
// Create a crew with a goal
const crew = new Crew(
{ goal: 'Research and summarize AI trends' },
openai
);
// Create specialized agents
const researcher = new Agent({
name: 'Researcher',
goal: 'Find and analyze information',
capabilities: ['research', 'analysis']
}, openai);
const writer = new Agent({
name: 'Writer',
goal: 'Create clear summaries',
capabilities: ['writing', 'summarization']
}, openai);
// Add agents to crew
crew.addAgent(researcher);
crew.addAgent(writer);
// Add tasks
crew.addTask('Research recent AI breakthroughs');
crew.addTask('Summarize findings in 3 bullet points');
// Execute
await crew.executeAllTasks();
const summary = await crew.achieveCrewGoal();
console.log('Result:', summary);
}
main();The examples/ directory contains several ready-to-run examples:
# Web researcher example
bun run examples/WebResearcher.ts
# Creative writing example
bun run examples/CreativeWriter.ts
# Persistent memory example
bun run examples/PersistentMemory.tstiny-crew/
├── src/
│ ├── Agent/ # Agent implementation
│ ├── Crew/ # Crew orchestration
│ ├── Memory/ # Memory system
│ ├── ModelRouter/ # Multi-model routing
│ ├── Tools/ # Built-in tools
│ └── utils/ # Utilities (logger, types, etc.)
├── docs/ # Documentation
├── examples/ # Example applications
├── tests/ # Test suite
└── data/ # Output directory for examples
- Memory System - Learn about knowledge sharing between agents
- Multi-Model Routing - Optimize costs with model routing
- Conversation History - Manage multi-turn conversations
- Agent Messaging - Enable agent-to-agent communication
- Streaming - Stream responses in real-time
- Custom Tools - Create your own tools