Package Exports
- aidistrictagents
- aidistrictagents/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (aidistrictagents) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
AI District Agent System
The simplest way to build, deploy, and orchestrate AI agents.
🚀 The industry's most developer-friendly AI agent system.
✨ Features
- 🎯 Zero Configuration - Just API key, everything else is automatic
- 🧠 AI-Powered Orchestration - Intelligent task routing and agent selection
- ⚡ One Method for Everything -
agent.do()
handles any task - 🔄 Auto-Everything - Auto-retry, auto-healing, auto-optimization
- 🛡️ Production-Ready - Circuit breakers, monitoring, fault tolerance
- 📱 Developer-Friendly - TypeScript support, clear errors, helpful suggestions
- 🌐 Industry Standard - Compatible with OpenAI, Google, Microsoft patterns
🚀 Quick Start (30 seconds)
npm install aidistrictagents
import { Agent } from 'aidistrictagents';
// That's it! Zero configuration needed
const agent = new Agent('your-api-key');
// Execute any task - AI automatically finds the best agent
const result = await agent.do('Generate a marketing email for our AI product');
console.log(result.result); // Your generated email!
🎯 Core Philosophy: "One Method for Everything"
Instead of learning 35+ methods, just use agent.do()
for everything:
// Content creation
await agent.do('Write a blog post about AI trends');
// Data analysis
await agent.do('Analyze this sales data: {users: 1250, revenue: 45000}');
// Code generation
await agent.do('Create a React component for a login form');
// Research
await agent.do('Research competitors in the AI space');
// Translation
await agent.do('Translate "Hello world" to French');
📊 Three Levels of Simplicity
Level 1: Standard (Recommended)
import { Agent } from 'aidistrictagents';
const agent = new Agent('your-api-key');
const result = await agent.do('Your task here');
if (result.success) {
console.log(result.result);
} else {
console.log('Error:', result.error);
console.log('Suggestions:', result.suggestions);
}
Level 2: Quick Start (Auto-ready)
import { quickAgent } from 'aidistrictagents';
const agent = await quickAgent('your-api-key'); // Auto-waits for ready
const result = await agent.do('Your task here');
Level 3: One-liner (Ultimate simplicity)
import { quickTask } from 'aidistrictagents';
const result = await quickTask('your-api-key', 'Write a haiku about coding');
console.log(result.result); // Done! 🎉
📋 Simple API Reference
Core Methods (Only 6 methods total!)
agent.do(task, options?)
Execute any task with AI-powered agent selection
const result = await agent.do('Generate a product description', {
priority: 'high', // 'low' | 'normal' | 'high'
timeout: 60000 // milliseconds
});
agent.doMany(tasks, options?)
Execute multiple tasks efficiently
const results = await agent.doMany([
'Generate a company name',
'Write a mission statement',
'Create a tagline'
], { maxConcurrent: 3 });
console.log(`${results.summary.successful}/${results.summary.total} completed`);
agent.systemStatus()
Check if everything is working
const status = await agent.systemStatus();
console.log(`System: ${status.status} - ${status.summary}`);
// Returns: 'excellent' | 'good' | 'fair' | 'poor'
agent.whoCanDo(skill)
Find agents for specific skills
const agents = await agent.whoCanDo('content-creation');
agents.forEach(agent => {
console.log(`${agent.name}: ${agent.performance}% performance`);
});
agent.availableSkills()
See what the system can do
const skills = await agent.availableSkills();
console.log('Available skills:', skills.join(', '));
// ['content-creation', 'data-analysis', 'coding', 'research', ...]
agent.addAgents(agents)
Register your own agents
await agent.addAgents([{
name: 'MyCustomAgent',
skills: ['custom-task', 'data-processing'],
endpoint: 'http://localhost:3001'
}]);
🛡️ Built-in Best Practices
✅ Auto-Configuration
- Smart defaults for everything
- No complex configuration objects
- Auto-retry with exponential backoff
- Circuit breaker for resilience
✅ Auto-Error Handling
- User-friendly error messages
- Automatic suggestions for fixes
- Graceful degradation
- No crashes, ever
✅ Auto-Intelligence
- AI picks the best agent automatically
- Performance-based routing
- Load balancing
- Capability matching
✅ Auto-Monitoring
- Health checks in background
- Performance tracking
- Automatic alerts
- Self-healing
📈 Real-World Examples
Content Creation Workflow
const agent = new Agent('your-api-key');
// Step 1: Research
const research = await agent.do('Research AI trends for 2025');
// Step 2: Create content
const blog = await agent.do(`Write a blog post about: ${research.result}`);
// Step 3: Optimize
const seo = await agent.do(`Optimize for SEO: ${blog.result}`);
// Step 4: Social media
const posts = await agent.do(`Create 5 social media posts for: ${blog.result}`);
Data Analysis Workflow
const analysis = await agent.do(`
Analyze this sales data and provide insights:
Q1: {revenue: 120000, customers: 450, churn: 0.05}
Q2: {revenue: 155000, customers: 580, churn: 0.03}
`);
const report = await agent.do(`Create executive summary: ${analysis.result}`);
Batch Processing
const tasks = [
'Generate a startup name for an AI company',
'Write a mission statement',
'Create a compelling tagline',
'Design a logo description',
'Write a press release'
];
const results = await agent.doMany(tasks);
console.log(`Business plan generated: ${results.summary.successful}/5 tasks completed`);
🏗️ Architecture & Advanced Features
For Power Users: Advanced API
If you need more control, use the advanced AgentClient
:
import { AgentClient } from 'aidistrictagents';
const client = new AgentClient({
apiKey: 'your-api-key',
requestTimeout: 30000,
maxRetries: 5,
circuitBreakerConfig: {
failureThreshold: 10,
recoveryTimeout: 60000
}
});
await client.initialize();
// Advanced task orchestration
const result = await client.performTask(
'Generate marketing copy for AI assistant',
{
context: { product: 'AI Assistant', tone: 'professional' },
priority: 'high',
preferredAgents: ['ContentCreator'],
timeout: 60000
}
);
console.log('Selected agent:', result.orchestration?.selectedAgent.name);
console.log('Selection reason:', result.orchestration?.selectionReason);
Workflow Management
const workflow = await client.createWorkflow([
{
id: 'research',
description: 'Research market trends',
capability: 'research'
},
{
id: 'analyze',
description: 'Analyze research data',
capability: 'data-analysis',
dependsOn: ['research'] // Wait for research to complete
},
{
id: 'generate',
description: 'Generate content based on analysis',
capability: 'content-creation',
dependsOn: ['analyze']
}
]);
const workflowResult = await workflow.execute();
Event Handling
// Listen to system events
client.on('task:orchestrated', (event) => {
console.log(`Task ${event.requestId} routed to ${event.agentId}`);
});
client.on('agent:registered', (event) => {
console.log(`New agent registered: ${event.name}`);
});
client.on('system:health', (health) => {
console.log(`System health: ${health.activeAgents}/${health.totalAgents} agents active`);
});
📦 Installation & Setup
NPM
npm install aidistrictagents
Yarn
yarn add aidistrictagents
Get API Key
- Sign up at AI District Dashboard => Coming Soon
- Create new API key
- Copy the key to your environment
// v2.0 (recommended)
import { Agent } from 'aidistrictagents';
const agent = new Agent('api-key');
const result = await agent.do('task');
📚 TypeScript Support
Full TypeScript definitions included:
import { Agent, TaskResult, SystemHealth, AgentInfo } from 'aidistrictagents';
const agent = new Agent('api-key');
const result: TaskResult = await agent.do('Generate content');
const health: SystemHealth = await agent.systemStatus();
const agents: AgentInfo[] = await agent.whoCanDo('content-creation');
⚡ Performance
- Startup: ~100ms (vs 2-5s for other systems)
- First Task: ~200ms (auto-initialization)
- Subsequent Tasks: ~50ms (intelligent caching)
- Memory Usage: <10MB (vs 50-100MB for other systems)
📚 Documentation
- Documentation: docs.aidistrictagents.com ## (Coming Soon)
- Email: support@aidistrictagents.com
🚀 Why Choose AI District?
Feature | AI District | Google A2A | OpenAI Swarm | Microsoft AutoGen |
---|---|---|---|---|
Setup Time | 30 seconds | 30 minutes | 1 hour | 2 hours |
API Complexity | 6 methods | 25+ methods | 15+ methods | 20+ methods |
Configuration | Zero | Complex | Medium | Complex |
Intelligence | AI-powered | Manual | Manual | Loop-based |
Error Handling | Automatic | Manual | Basic | Manual |
Production Ready | ✅ | ✅ | ❌ (Experimental) | ✅ |
Start building intelligent AI agent systems in seconds, not hours.