Back to Skills

orchestrating-multi-agent-systems

jeremylongshore
Updated Yesterday
174 views
712
74
712
View on GitHub
Metaaiautomationdesign

About

This skill enables developers to orchestrate multi-agent systems by managing handoffs, routing, and workflows across different AI providers. It's designed for building complex AI applications that require collaboration, task delegation, and coordination between specialized agents. Use it when you need to structure and automate interactions within a team of AI agents.

Quick Install

Claude Code

Recommended
Plugin CommandRecommended
/plugin add https://github.com/jeremylongshore/claude-code-plugins-plus
Git CloneAlternative
git clone https://github.com/jeremylongshore/claude-code-plugins-plus.git ~/.claude/skills/orchestrating-multi-agent-systems

Copy and paste this command in Claude Code to install this skill

Documentation

Prerequisites

Before using this skill, ensure you have:

  • Node.js 18+ installed for TypeScript agent development
  • AI SDK v5 package installed (npm install ai)
  • API keys for AI providers (OpenAI, Anthropic, Google, etc.)
  • Understanding of agent-based architecture patterns
  • TypeScript knowledge for agent implementation
  • Project directory structure for multi-agent systems

Instructions

Step 1: Initialize Project Structure

Set up the foundation for your multi-agent system:

  1. Create project directory with necessary subdirectories
  2. Initialize npm project with TypeScript configuration
  3. Install AI SDK v5 and provider-specific packages
  4. Set up configuration files for agent orchestration

Step 2: Define Agent Roles

Identify and specify specialized agents needed:

  • Determine agent responsibilities and capabilities
  • Define agent system prompts with clear instructions
  • Specify tools each agent can access
  • Establish agent communication protocols

Step 3: Implement Agents

Create individual agent files with proper configuration:

  1. Write agent initialization code with AI SDK
  2. Configure system prompts for agent behavior
  3. Define tool functions for agent capabilities
  4. Implement handoff rules for inter-agent delegation

Step 4: Configure Orchestration

Set up coordination between agents:

  • Define workflow sequences for task processing
  • Implement routing logic for task distribution
  • Configure handoff mechanisms between agents
  • Set up state management for multi-step workflows

Step 5: Test and Refine

Validate the multi-agent system functionality:

  • Test individual agent responses and behaviors
  • Verify handoff execution between agents
  • Validate routing logic with different input scenarios
  • Monitor coordination and identify bottlenecks

Output

The skill generates a complete multi-agent system including:

Project Structure

{baseDir}/
├── agents/
│   ├── coordinator.ts       # Main orchestration agent
│   ├── specialist-1.ts      # Domain-specific agent
│   ├── specialist-2.ts      # Domain-specific agent
│   └── [additional agents]
├── orchestration/
│   ├── workflow.ts          # Workflow definitions
│   ├── routing.ts           # Routing logic
│   └── handoffs.ts          # Handoff configurations
├── tools/
│   └── [agent tools]        # Shared tool implementations
├── config/
│   └── agents.config.ts     # Agent configurations
└── package.json             # Dependencies

Agent Implementation Files

  • TypeScript files with AI SDK v5 integration
  • System prompts tailored to each agent role
  • Tool definitions and implementations
  • Handoff rules and coordination logic

Orchestration Configuration

  • Workflow definitions for task sequences
  • Routing rules for intelligent task distribution
  • State management for multi-step processes
  • Error handling and fallback mechanisms

Documentation

  • Agent role descriptions and capabilities
  • Workflow diagrams showing agent interactions
  • API documentation for agent endpoints
  • Usage examples for common scenarios

Error Handling

Common issues and solutions:

Agent Initialization Failures

  • Error: AI SDK provider configuration invalid
  • Solution: Verify API keys in environment variables, check provider-specific setup requirements

Handoff Execution Errors

  • Error: Agent handoff fails or creates circular dependencies
  • Solution: Review handoff rules for clarity, implement handoff depth limits, add fallback agents

Routing Logic Failures

  • Error: Tasks routed to incorrect agent or no agent
  • Solution: Refine routing criteria, add default routing rules, implement topic classification improvement

Tool Access Violations

  • Error: Agent attempts to use unauthorized tools
  • Solution: Review tool permissions per agent, implement proper access control, validate tool configurations

Workflow Deadlocks

  • Error: Multi-agent workflow stalls without completion
  • Solution: Implement timeout mechanisms, add workflow monitoring, design escape conditions for stuck states

Resources

AI SDK Documentation

  • AI SDK v5 official documentation for agent creation
  • Provider-specific integration guides (OpenAI, Anthropic, Google)
  • Tool definition and implementation examples
  • Handoff and routing pattern references

Multi-Agent Architecture Patterns

  • Coordinator-worker pattern for task distribution
  • Pipeline pattern for sequential processing
  • Hub-and-spoke pattern for centralized coordination
  • Peer-to-peer pattern for collaborative agents

Agent Design Best Practices

  • Single responsibility principle for agent specialization
  • Clear handoff criteria and routing rules
  • Comprehensive error handling and fallbacks
  • State management for complex workflows
  • Testing strategies for multi-agent systems

Example Use Cases

  • Code generation pipelines with specialized agents
  • Customer support routing systems
  • Research and analysis workflows
  • Content creation and review pipelines
  • Data processing and validation systems

GitHub Repository

jeremylongshore/claude-code-plugins-plus
Path: plugins/ai-ml/ai-sdk-agents/skills/ai-sdk-agents
aiautomationclaude-codedevopsmarketplacemcp

Related Skills

content-collections

Meta

This skill provides a production-tested setup for Content Collections, a TypeScript-first tool that transforms Markdown/MDX files into type-safe data collections with Zod validation. Use it when building blogs, documentation sites, or content-heavy Vite + React applications to ensure type safety and automatic content validation. It covers everything from Vite plugin configuration and MDX compilation to deployment optimization and schema validation.

View skill

sglang

Meta

SGLang is a high-performance LLM serving framework that specializes in fast, structured generation for JSON, regex, and agentic workflows using its RadixAttention prefix caching. It delivers significantly faster inference, especially for tasks with repeated prefixes, making it ideal for complex, structured outputs and multi-turn conversations. Choose SGLang over alternatives like vLLM when you need constrained decoding or are building applications with extensive prefix sharing.

View skill

evaluating-llms-harness

Testing

This Claude Skill runs the lm-evaluation-harness to benchmark LLMs across 60+ standardized academic tasks like MMLU and GSM8K. It's designed for developers to compare model quality, track training progress, or report academic results. The tool supports various backends including HuggingFace and vLLM models.

View skill

llamaguard

Other

LlamaGuard is Meta's 7-8B parameter model for moderating LLM inputs and outputs across six safety categories like violence and hate speech. It offers 94-95% accuracy and can be deployed using vLLM, Hugging Face, or Amazon SageMaker. Use this skill to easily integrate content filtering and safety guardrails into your AI applications.

View skill