Formation Examples

Complete, working MUXI formation examples. Copy, customize, and deploy.

Quick Start

Each example includes:

  • Complete formation.afs
  • README with setup instructions
  • secrets template
  • Testing commands
  • Customization tips

Examples

01. Simple Chatbot

Difficulty: Beginner | Time: 2 minutes

The simplest MUXI formation - one agent, no tools, no memory.

Perfect for:

  • Learning MUXI basics
  • Testing setup
  • Building a foundation
cp -r examples/01-simple-chatbot my-bot
cd my-bot
muxi secrets setup
muxi dev

02. Customer Support

Difficulty: Intermediate | Time: 5 minutes

Support bot with memory and knowledge base.

Features:

  • โœ… Remembers conversations
  • โœ… Company knowledge base (FAQs, policies)
  • โœ… Empathetic soul
  • โœ… Clarifies ambiguous questions

Perfect for:

  • Customer service
  • Internal helpdesk
  • FAQ automation
cp -r examples/02-customer-support my-support
cd my-support
# Add your docs to knowledge/
muxi secrets setup
muxi dev

03. Research Assistant

Difficulty: Intermediate | Time: 10 minutes

AI researcher with web search and file access.

Features:

  • โœ… Web search (Brave API)
  • โœ… File system access
  • โœ… Creates PDF reports
  • โœ… Tool chaining

Perfect for:

  • Market research
  • Competitive analysis
  • Information gathering

Requirements:

  • Brave Search API key (free tier)
cp -r examples/03-research-assistant my-researcher
cd my-researcher
npm install -g @modelcontextprotocol/server-brave-search
npm install -g @modelcontextprotocol/server-filesystem
muxi secrets setup
muxi dev

04. Code Reviewer

Difficulty: Advanced | Time: 15 minutes

Automated code reviewer integrated with GitHub.

Features:

  • โœ… Reviews pull requests automatically
  • โœ… Checks security, performance, quality
  • โœ… Posts comments on GitHub
  • โœ… Creates issues for critical problems

Perfect for:

  • Open source projects
  • Team code quality
  • Automated reviews

Requirements:

  • GitHub Personal Access Token
  • Public MUXI server (for webhooks)
cp -r examples/04-code-reviewer my-reviewer
cd my-reviewer
npm install -g @modelcontextprotocol/server-github
muxi secrets setup
muxi deploy production  # Needs public URL

05. Multi-Agent Team

Difficulty: Advanced | Time: 10 minutes

Team of specialized agents with automatic coordination.

Features:

  • โœ… Researcher, Analyst, Writer agents
  • โœ… Automatic workflow decomposition
  • โœ… Parallel task execution
  • โœ… Agent-to-agent collaboration

Perfect for:

  • Complex tasks requiring multiple skills
  • Business intelligence
  • Content creation at scale
cp -r examples/05-multi-agent-team my-team
cd my-team
npm install -g @modelcontextprotocol/server-brave-search
muxi secrets setup
muxi dev

Example Comparison

Example Agents Tools Memory Knowledge Difficulty
Simple Chatbot 1 0 โŒ โŒ โญ
Customer Support 1 0 โœ… โœ… โญโญ
Research Assistant 1 2 โœ… โŒ โญโญ
Code Reviewer 1 1 โœ… โŒ โญโญโญ
Multi-Agent Team 3 2 โœ… โŒ โญโญโญ

Learning Path

Recommended order:

  1. Start: Simple Chatbot โ†’ Understand MUXI basics
  2. Add Memory: Customer Support โ†’ Conversations persist
  3. Add Tools: Research Assistant โ†’ Give agents capabilities
  4. Integration: Code Reviewer โ†’ External systems (GitHub)
  5. Advanced: Multi-Agent Team โ†’ Orchestration and workflows

Testing Examples

All examples include test commands. General pattern:

# Start formation
muxi dev

# Test with curl
curl -X POST http://localhost:8001/v1/chat \
  -H "Content-Type: application/json" \
  -d '{"message": "Your test message"}'

# Or open browser
open http://localhost:8001/chat

Customization

Each example is a starting point. Common customizations:

Change LLM

llm:
  models:
    - text: "openai/gpt-4-turbo"  # Faster, cheaper
    # or
    - text: "openai/gpt-4o"       # Best reasoning
    # or
    - text: "anthropic/claude-3-opus"

Add Tools

Create mcp/postgres.afs:

schema: "1.0.0"
id: postgres
type: command
command: npx
args: ["-y", "@modelcontextprotocol/server-postgres"]
auth:
  type: env
  DATABASE_URL: "${{ secrets.DATABASE_URL }}"

Adjust Memory

memory:
  buffer:
    size: 100  # More messages

Change Soul

overlord:
  soul: |
    You are a friendly, casual assistant.
    Use conversational language and be approachable.

Deploy to Production

All examples can be deployed:

# 1. Create profile
muxi profiles add production \
  --server https://muxi.yourcompany.com:7890 \
  --key-id $KEY_ID \
  --secret $SECRET

# 2. Deploy
muxi deploy production

# 3. Test
curl https://muxi.yourcompany.com:7890/formations/my-formation/v1/chat \
  -H "Authorization: Bearer $MUXI_API_KEY" \
  -d '{"message": "..."}'

Next Steps

After trying examples:

Contributing Examples

Have a great formation example? Share it!

  1. Fork the muxi-ai/muxi repo
  2. Add your example to docs/examples/
  3. Follow the format (README, formation.afs, secrets)
  4. Submit a pull request

Troubleshooting

See Troubleshooting Guide for common issues.

Quick fixes:

# Installation
curl -fsSL https://muxi.org/install | bash

# Server not running
muxi-server start

# Secrets missing
muxi secrets setup

# Check logs
muxi logs formation-name

Get Help