# Quick Start - 5 Minutes to ruv-FANN Get up and running with ruv-FANN in just 5 minutes! This tutorial will have you training neural networks and orchestrating AI swarms in no time. ## šŸš€ Installation (1 minute) ### Rust Installation ```bash # Install Rust (if not already installed) curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh source ~/.cargo/env # Add ruv-FANN to your project cargo add ruv-fann ``` ### JavaScript Installation ```bash # Install the swarm orchestration SDK npm install ruv-swarm # Install CLI tools npm install -g claude-flow ruv-swarm ``` ## 🧠 Neural Network Example (2 minutes) Create a simple neural network that learns the XOR function: ```rust use ruv_fann::prelude::*; fn main() -> Result<(), Box> { println!("🧠 Training XOR neural network..."); // Create network: 3 inputs -> 4 hidden -> 2 hidden -> 1 output let mut net = NeuralNetwork::builder() .input_size(3) .hidden_layers(&[4, 2]) .output_size(1) .activation(Activation::Sigmoid) .learning_rate(0.7) .build()?; // XOR training data (including bias) let training_data = vec![ ([0.0, 0.0, 1.0], [0.0]), // 0 XOR 0 = 0 ([0.0, 1.0, 1.0], [1.0]), // 0 XOR 1 = 1 ([1.0, 0.0, 1.0], [1.0]), // 1 XOR 0 = 1 ([1.0, 1.0, 1.0], [0.0]), // 1 XOR 1 = 0 ]; // Train the network net.train(&training_data, 2000, 0.001)?; // Test all combinations println!("\nšŸ“Š Testing XOR function:"); for (input, expected) in &training_data { let output = net.run(&input[..2])? ; // Don't include bias in test let rounded = if output[0] > 0.5 { 1.0 } else { 0.0 }; println!("XOR({}, {}) = {:.3} (expected {}, rounded {})", input[0], input[1], output[0], expected[0], rounded); } println!("āœ… Neural network training complete!"); Ok(()) } ``` **Expected Output:** ``` 🧠 Training XOR neural network... šŸ“Š Testing XOR function: XOR(0, 0) = 0.067 (expected 0, rounded 0) XOR(0, 1) = 0.932 (expected 1, rounded 1) XOR(1, 0) = 0.925 (expected 1, rounded 1) XOR(1, 1) = 0.089 (expected 0, rounded 0) āœ… Neural network training complete! ``` ## šŸ Swarm Intelligence Example (2 minutes) Create an AI swarm that coordinates multiple agents: ```typescript import { RuvSwarm } from 'ruv-swarm'; async function main() { console.log('šŸ Initializing AI swarm...'); // Initialize WASM runtime const ruvSwarm = await RuvSwarm.initialize({ useSIMD: true, maxAgents: 5 }); // Create swarm with hierarchical coordination const swarm = await ruvSwarm.createSwarm({ name: 'quickstart-swarm', topology: 'hierarchical', strategy: 'balanced', maxAgents: 5 }); console.log('šŸ‘„ Spawning specialized agents...'); // Spawn different types of agents const agents = await Promise.all([ swarm.spawn({ type: 'researcher', name: 'Researcher Alpha' }), swarm.spawn({ type: 'analyst', name: 'Data Analyst' }), swarm.spawn({ type: 'coder', name: 'Code Generator' }) ]); console.log(`āœ… Spawned ${agents.length} agents`); // Orchestrate a coordinated task console.log('šŸŽÆ Orchestrating collaborative task...'); const task = { description: 'Analyze trending technologies and create summary report', priority: 'high', parameters: { sources: ['tech blogs', 'research papers', 'github trends'], timeframe: '2024', format: 'markdown' } }; const result = await swarm.orchestrate(task); console.log('šŸ“Š Task Results:'); console.log(`- Status: ${result.status}`); console.log(`- Agents involved: ${result.agentsUsed}`); console.log(`- Execution time: ${result.executionTime}ms`); console.log(`- Output length: ${result.output.length} characters`); // Get swarm performance metrics const metrics = await swarm.getMetrics(); console.log('\nšŸ“ˆ Swarm Performance:'); console.log(`- Tasks completed: ${metrics.tasksCompleted}`); console.log(`- Success rate: ${metrics.successRate}%`); console.log(`- Avg response time: ${metrics.avgResponseTime}ms`); await swarm.terminate(); console.log('šŸ Swarm terminated successfully!'); } // Run the example main().catch(console.error); ``` **Expected Output:** ``` šŸ Initializing AI swarm... šŸ‘„ Spawning specialized agents... āœ… Spawned 3 agents šŸŽÆ Orchestrating collaborative task... šŸ“Š Task Results: - Status: completed - Agents involved: 3 - Execution time: 1247ms - Output length: 2841 characters šŸ“ˆ Swarm Performance: - Tasks completed: 1 - Success rate: 100% - Avg response time: 415ms šŸ Swarm terminated successfully! ``` ## 🌐 CLI Quick Commands (30 seconds) Try these commands to explore the ecosystem: ```bash # Initialize a swarm ruv-swarm init --topology mesh --max-agents 5 # Spawn agents quickly ruv-swarm spawn researcher:2 analyst:1 coder:2 # Check status ruv-swarm status --agents # Execute a simple task ruv-swarm orchestrate "Hello World coordination test" --priority medium # View performance metrics ruv-swarm metrics --summary ``` ## šŸŽÆ What You Accomplished In just 5 minutes, you've: āœ… **Set up ruv-FANN** - Installed Rust and JavaScript SDKs āœ… **Trained a neural network** - Learned XOR function with 100% accuracy āœ… **Created AI swarm** - Coordinated multiple intelligent agents āœ… **Executed distributed task** - Orchestrated collaborative AI work āœ… **Measured performance** - Tracked metrics and success rates ## šŸš€ Next Steps Now that you're up and running, explore these advanced features: ### 🧠 Advanced Neural Networks - **[Neural Networks Guide](Neural-Networks)** - Deep learning architectures - **[Semantic Cartan Matrix](Semantic-Cartan-Matrix)** - Mathematical neural innovations - **[Performance Optimization](Performance-Benchmarks)** - SIMD and GPU acceleration ### šŸ Swarm Intelligence - **[Swarm Intelligence](Swarm-Intelligence)** - Multi-agent coordination - **[Advanced Tutorials](Advanced-Tutorials)** - Complex orchestration patterns - **[Production Deployment](Production-Deployment)** - Enterprise-scale deployment ### šŸ”§ Integration & Development - **[API Reference](API-Reference)** - Complete API documentation - **[SDK Documentation](SDK-Documentation)** - Client libraries and bindings - **[CLI Tools](CLI-Tools)** - Command-line interface mastery ### šŸ“š Learning Resources - **[Use Cases](Use-Cases)** - Real-world applications - **[Best Practices](Best-Practices)** - Professional development patterns - **[Troubleshooting](Troubleshooting)** - Common issues and solutions ## šŸ’” Quick Tips - **Performance**: Enable SIMD for 2-4x speed improvement - **Debugging**: Use `RUST_LOG=debug` for detailed logging - **Scaling**: Start with 3-5 agents, scale up as needed - **Memory**: Monitor usage with built-in metrics - **Integration**: Check out [Integration Guides](Integration-Guides) for frameworks ## šŸ¤ Get Help - **[Troubleshooting](Troubleshooting)** - Common issues and solutions - **[FAQ](FAQ)** - Frequently asked questions - **[GitHub Issues](https://github.com/ruvnet/ruv-FANN/issues)** - Bug reports and feature requests - **[Community Resources](Community-Resources)** - Links and external resources --- **Congratulations!** šŸŽ‰ You're now ready to build the future of AI with ruv-FANN. *Time taken: 5 minutes | Skills gained: Neural networks, swarm intelligence, distributed AI*