Skip to main content

A sophisticated multi-agent AI system for collaborative problem-solving through specialized AI campfires

Project description

CampfireValley

A Python library that extends the Campfires framework by introducing the concept of "valleys" as interconnected, secure communities of campfires. The library manages docks as gateways for inter-valley communication, handles riverboat (torch) exchanges via MCP, and provides default campfires for loading/offloading, security sanitization, and justice enforcement.

๐Ÿš€ Project Status

Phase 2 Implementation: COMPLETED โœ…

CampfireValley is now ~95% complete with comprehensive enterprise-grade features implemented and tested. The system provides a complete distributed torch processing framework.

โœ… Phase 1 Components (Core Infrastructure)

  • ๐Ÿ” Key Manager: Complete AES-256 and RSA key management system
  • ๐Ÿ”„ Redis MCP Broker: Full pub/sub messaging with connection management
  • ๐Ÿ“ฆ Torch Serialization: Enhanced with Redis transport and MCP communication
  • ๐Ÿญ Dockmaster Campfire: Complete with Loader, Router, and Packer campers
  • ๐Ÿ—๏ธ Core Architecture: Interfaces, models, and base classes

โœ… Phase 2 Components (Enterprise Features)

  • ๐Ÿ›ก๏ธ VALI Services: Complete security scanning and validation framework
  • โš–๏ธ Justice System: Advanced policy enforcement and violation handling
  • ๐Ÿ”ง Specialist Campfires: Domain-specific processing units (Sanitizer, Validator, Router)
  • ๐ŸŒ Advanced Routing: Multi-hop routing with load balancing and failover
  • ๐Ÿ“Š Monitoring & Logging: Comprehensive metrics, alerts, and structured logging
  • โš™๏ธ Configuration Management: Multi-environment config with validation and encryption
  • ๐Ÿ’พ Hierarchical Storage: Multi-tier storage with compression and deduplication

๐Ÿ”„ Future Enhancements

  • Web Interface: Management dashboard and monitoring UI
  • Distributed Consensus: Multi-valley coordination protocols
  • Machine Learning: Intelligent routing and threat detection

Features

Core Infrastructure (Phase 1)

  • Valley Management: Self-contained instances hosting multiple campfires
  • Dock Gateways: Secure entry points for inter-valley communication
  • MCP Integration: Redis-based message communication protocol
  • Key Management: AES-256 encryption and RSA digital signatures
  • GitHub Actions-style Configuration: Familiar YAML configuration format

Enterprise Features (Phase 2)

  • ๐Ÿ›ก๏ธ VALI Security Services:
    • Content validation and signature verification
    • Enhanced security scanning with threat detection
    • Service registry and coordination
  • โš–๏ธ Justice System:
    • Policy-based access control and enforcement
    • Violation detection and automated responses
    • Rate limiting and abuse prevention
  • ๐Ÿ”ง Specialist Campfires:
    • Sanitizer: Content cleaning and threat removal
    • Validator: Data integrity and format validation
    • Router: Intelligent routing decisions
  • ๐ŸŒ Advanced Routing:
    • Multi-hop routing with path optimization
    • Smart load balancing algorithms
    • Automatic failover and health checking
  • ๐Ÿ“Š Monitoring & Logging:
    • Real-time metrics collection and alerting
    • Structured logging with multiple handlers
    • Performance monitoring and health checks
  • โš™๏ธ Configuration Management:
    • Multi-environment configuration (dev/prod)
    • Schema validation and encryption
    • Hot-reload and change tracking
  • ๐Ÿ’พ Hierarchical Storage:
    • Multi-tier storage (hot/warm/cold/archive)
    • Data deduplication and compression
    • Intelligent lifecycle management

๐ŸŽฏ Demos & Examples

CampfireValley includes comprehensive demos showcasing real-world AI agent collaboration workflows. These demos demonstrate the complete system capabilities from idea generation to technical implementation.

๐Ÿš€ Marketing Team Demo

The marketing team demo showcases a complete AI-driven workflow where marketing strategists generate innovative ideas and collaborate with development teams to create technical implementations.

Demo Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Marketing      โ”‚    โ”‚   Development    โ”‚    โ”‚   Generated     โ”‚
โ”‚  Strategist     โ”‚โ”€โ”€โ”€โ–ถโ”‚   Team API       โ”‚โ”€โ”€โ”€โ–ถโ”‚   Report        โ”‚
โ”‚  (AI Agent)     โ”‚    โ”‚  (Dockerized)    โ”‚    โ”‚   (JSON/HTML)   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Quick Demo Execution

Option 1: Simplified Demo (Recommended)

# Start Docker containers
docker-compose up -d

# Run the simplified marketing demo
python simple_marketing_demo.py

Option 2: Full Valley Demo

# Start Docker containers
docker-compose up -d

# Run the complete valley demo
python demo_marketing_team.py

Demo Workflow

  1. Idea Generation: Marketing strategist AI generates innovative business ideas
  2. Strategic Analysis: Each idea is analyzed for market potential and feasibility
  3. Development Requests: Ideas are formatted and sent to the development team API
  4. Technical Analysis: Development team provides detailed technical requirements
  5. Report Generation: Complete workflow results are compiled into comprehensive reports

Expected Output

The demo generates:

  • 3 Marketing Ideas: E-commerce Innovation, SaaS Solution, Mobile App Concept
  • Strategic Analysis: Market research, target audience, competitive analysis
  • Technical Requirements: Architecture, features, UX considerations
  • Development Analysis: Detailed technical implementation plans
  • Comprehensive Report: JSON and HTML formats with complete workflow results

Demo Files

  • simple_marketing_demo.py: Streamlined demo bypassing MCP complexities
  • demo_marketing_team.py: Full valley implementation with MCP integration
  • development_team_server.py: Dockerized development team API service
  • docker-compose.yml: Container orchestration for demo services

๐Ÿณ Docker Container Services

The demo utilizes several containerized services:

Service Container Port Purpose
Development Team campfire-development-team 8080 Technical analysis API
Redis MCP Broker campfire-redis 6379 Message communication
Ollama LLM campfire-ollama 11434 Local AI model serving
Prometheus campfire-prometheus 9090 Monitoring and metrics

Container Status Check

# View running containers
docker ps

# Check container logs
docker logs campfire-development-team
docker logs campfire-redis

๐Ÿ”ง Troubleshooting

Common Issues and Solutions

1. MCP Broker Connection Issues

# Symptom: Demo hangs at "Subscribing to MCP channels"
# Solution: Use simplified demo
python simple_marketing_demo.py

2. Docker Container Issues

# Restart all containers
docker-compose down
docker-compose up -d

# Check container health
docker ps

3. Development Team API 404 Errors

# Verify development team container is running
docker logs campfire-development-team

# Check API endpoint
curl http://localhost:8080/api/develop_website

4. Port Conflicts

# Check port usage
netstat -an | findstr :8080
netstat -an | findstr :6379

# Modify ports in docker-compose.yml if needed

Demo Variations

Simplified Workflow (No MCP)

  • Bypasses MCP broker subscription issues
  • Direct API communication
  • Faster execution
  • Recommended for demonstrations

Full Valley Workflow (With MCP)

  • Complete CampfireValley architecture
  • MCP broker integration
  • Inter-valley communication
  • Production-like environment

๐Ÿ“Š Demo Reports

Demo execution generates detailed reports:

JSON Report Structure:

{
  "execution_summary": {
    "ideas_generated": 3,
    "dev_requests_sent": 3,
    "successful_responses": 3,
    "execution_time": "45.2 seconds"
  },
  "marketing_ideas": [...],
  "development_analysis": [...],
  "workflow_metrics": {...}
}

Report Locations:

  • simplified_marketing_report_YYYYMMDD_HHMMSS.json
  • marketing_team_report.html (if HTML generation enabled)

Quick Start

Installation

pip install campfirevalley

Basic Usage

  1. Create a valley configuration:
campfirevalley create-config MyValley --output manifest.yaml
  1. Start a valley:
campfirevalley start MyValley --manifest manifest.yaml
  1. Programmatic usage:
import asyncio
from campfirevalley import Valley

async def main():
    # Create and start a valley
    valley = Valley("MyValley", "./manifest.yaml")
    await valley.start()
    
    # Valley is now running and can communicate with other valleys
    print(f"Valley '{valley.name}' is running")
    
    # Stop the valley
    await valley.stop()

asyncio.run(main())

๐Ÿ—๏ธ Phase 1 Implementation Details

Key Manager (campfirevalley.key_manager)

  • AES-256 Encryption: Secure payload encryption/decryption
  • RSA Digital Signatures: Torch signing and verification
  • Key Rotation: Community-based key management
  • Secure Storage: Encrypted key storage in .secrets/

Redis MCP Broker (campfirevalley.mcp)

  • Pub/Sub Messaging: Redis-based inter-valley communication
  • Connection Management: Robust connection pooling and error handling
  • Message Routing: Channel-based message distribution
  • Async Support: Full asyncio compatibility

Enhanced Torch Model (campfirevalley.models)

  • Redis Serialization: Optimized for Redis transport
  • MCP Envelopes: Structured message format
  • Compression: Automatic compression for large payloads
  • Routing Channels: Smart channel determination

Dockmaster Campfire (campfirevalley.campfires.dockmaster)

  • LoaderCamper: Torch validation and unpacking
  • RouterCamper: Intelligent routing decisions
  • PackerCamper: Transport preparation and packaging
  • Pipeline Processing: Complete torch processing workflow

๐Ÿ—๏ธ Phase 2 Implementation Details

VALI Services (campfirevalley.vali)

  • Service Registry: Centralized service discovery and management
  • Content Validator: Deep content analysis and validation
  • Signature Verifier: Cryptographic signature verification
  • Security Scanner: Advanced threat detection with multiple engines
  • Coordinator: Service orchestration and lifecycle management

Justice System (campfirevalley.justice)

  • Policy Engine: Rule-based access control and enforcement
  • Enforcement Engine: Automated violation response and remediation
  • Violation Detection: Real-time monitoring and threat identification
  • Rate Limiting: Configurable rate limiting and abuse prevention
  • Audit Trail: Complete violation and enforcement logging

Specialist Campfires (campfirevalley.specialist_campfires)

  • SanitizerCampfire: Content sanitization with multiple levels
  • ValidatorCampfire: Data validation with custom rules
  • RouterCampfire: Intelligent routing with strategy selection
  • Configurable Rules: Custom sanitization, validation, and routing rules
  • Pipeline Integration: Seamless integration with torch processing

Advanced Routing (campfirevalley.routing)

  • Route Optimization: Intelligent path selection and optimization
  • Load Balancing: Multiple algorithms (round-robin, weighted, least-connections)
  • Health Checking: Continuous endpoint health monitoring
  • Failover Strategies: Automatic failover with multiple strategies
  • Metrics Collection: Real-time routing performance metrics

Monitoring & Logging (campfirevalley.monitoring)

  • Metrics System: Comprehensive metrics collection and aggregation
  • Alert Management: Configurable alerts with multiple severity levels
  • Structured Logging: JSON-based logging with multiple handlers
  • Performance Monitoring: Real-time performance tracking
  • Health Checking: System-wide health monitoring

Configuration Management (campfirevalley.config_manager)

  • Multi-Environment: Separate configs for development, production, etc.
  • Schema Validation: JSON Schema-based configuration validation
  • Encryption Support: Sensitive configuration data encryption
  • Hot Reload: Runtime configuration updates without restart
  • Change Tracking: Complete configuration change history

Hierarchical Storage (campfirevalley.hierarchical_storage)

  • Multi-Tier Storage: Hot, warm, cold, and archive tiers
  • Data Lifecycle: Intelligent data movement between tiers
  • Deduplication: Content-based deduplication to save space
  • Compression: Configurable compression algorithms
  • Storage Optimization: Automated storage optimization and cleanup

Usage Example

import asyncio
from campfirevalley import Valley, CampfireKeyManager, RedisMCPBroker
from campfirevalley.campfires import DockmasterCampfire
from campfirevalley.models import Torch

async def main():
    # Initialize components
    key_manager = CampfireKeyManager("MyValley")
    mcp_broker = RedisMCPBroker("redis://localhost:6379")
    dockmaster = DockmasterCampfire(mcp_broker)
    
    # Start services
    await mcp_broker.connect()
    await dockmaster.start()
    
    # Create and process a torch
    torch = Torch(
        id="example_001",
        sender_valley="MyValley",
        target_address="TargetValley:dockmaster/loader",
        payload={"message": "Hello from CampfireValley!"},
        signature="example_signature"
    )
    
    # Process through Dockmaster pipeline
    response = await dockmaster.process_torch(torch)
    print(f"Processed torch: {response}")
    
    # Cleanup
    await dockmaster.stop()
    await mcp_broker.disconnect()

asyncio.run(main())

๐Ÿ”ง Configuration-Driven Architecture

CampfireValley implements a comprehensive configuration-driven approach that enables flexible, maintainable, and environment-specific deployments without code changes.

Core Configuration Philosophy

The system follows these key principles:

  • Declarative Configuration: Define what you want, not how to achieve it
  • Environment Separation: Clean separation between dev, staging, and production
  • Schema Validation: All configurations are validated against JSON schemas
  • Hot Reload: Runtime configuration updates without service restart
  • Encryption Support: Sensitive data is automatically encrypted

Configuration Hierarchy

CampfireValley uses a multi-layered configuration system:

  1. Base Configuration: Core system defaults
  2. Environment Configuration: Environment-specific overrides (dev/prod)
  3. Valley Configuration: Valley-specific settings
  4. Runtime Configuration: Dynamic updates during operation

GitHub Actions-Style YAML Format

CampfireValley uses familiar GitHub Actions-style YAML configuration:

name: "MyValley"
version: "1.0"

env:
  dock_mode: "public"
  security_level: "standard"
  auto_create_dock: true

campfires:
  visible: ["helper", "processor"]
  hidden: ["internal"]

community:
  discovery: true
  trusted_valleys: ["FriendValley"]

# Advanced configuration sections
security:
  vali:
    enabled: true
    scan_level: "comprehensive"
    threat_detection: true
  
  justice:
    enabled: true
    policy_enforcement: "strict"
    rate_limiting:
      requests_per_minute: 100
      burst_limit: 20

routing:
  strategy: "intelligent"
  load_balancing: "weighted_round_robin"
  health_checks:
    enabled: true
    interval: 30
    timeout: 5

storage:
  hierarchical:
    enabled: true
    tiers:
      hot: { retention: "7d", compression: false }
      warm: { retention: "30d", compression: "lz4" }
      cold: { retention: "1y", compression: "gzip" }
      archive: { retention: "7y", compression: "bzip2" }

monitoring:
  metrics:
    enabled: true
    collection_interval: 10
  
  logging:
    level: "INFO"
    format: "json"
    handlers: ["console", "file", "redis"]
  
  alerts:
    enabled: true
    channels: ["email", "slack"]

Environment-Specific Configuration

Create separate configuration files for different environments:

config/dev.yaml:

extends: "base.yaml"

env:
  security_level: "development"
  debug: true

monitoring:
  logging:
    level: "DEBUG"

security:
  vali:
    scan_level: "basic"

config/prod.yaml:

extends: "base.yaml"

env:
  security_level: "maximum"
  debug: false

security:
  vali:
    scan_level: "comprehensive"
    threat_detection: true
  
  justice:
    policy_enforcement: "strict"

monitoring:
  alerts:
    enabled: true
    severity_threshold: "warning"

Configuration Management Features

1. Schema Validation

All configurations are validated against JSON schemas:

from campfirevalley.config_manager import ConfigManager

# Load and validate configuration
config_manager = ConfigManager()
config = config_manager.load_config("config/prod.yaml")
# Automatically validates against schema

2. Encryption Support

Sensitive configuration data is automatically encrypted:

database:
  host: "db.example.com"
  username: "admin"
  password: "!encrypted:AES256:base64encodeddata"  # Auto-encrypted

3. Hot Reload

Update configurations without restarting services:

# Configuration changes are automatically detected and applied
config_manager.watch_for_changes()

4. Environment Variables

Override any configuration value with environment variables:

export CAMPFIREVALLEY_SECURITY_LEVEL="maximum"
export CAMPFIREVALLEY_MONITORING_LOGGING_LEVEL="ERROR"

Configuration Sections Reference

Core Settings

  • name: Valley identifier
  • version: Configuration version
  • env: Environment variables and basic settings

Security Configuration

  • security.vali: VALI security services settings
  • security.justice: Justice system and policy enforcement
  • security.encryption: Encryption and key management

Routing Configuration

  • routing.strategy: Routing algorithm selection
  • routing.load_balancing: Load balancing configuration
  • routing.health_checks: Health monitoring settings

Storage Configuration

  • storage.hierarchical: Multi-tier storage settings
  • storage.compression: Compression algorithms
  • storage.retention: Data retention policies

Monitoring Configuration

  • monitoring.metrics: Metrics collection settings
  • monitoring.logging: Logging configuration
  • monitoring.alerts: Alert management

Best Practices

  1. Use Environment Inheritance: Extend base configurations for environments
  2. Validate Early: Always validate configurations during startup
  3. Encrypt Secrets: Use the built-in encryption for sensitive data
  4. Monitor Changes: Enable configuration change tracking
  5. Test Configurations: Validate configurations in CI/CD pipelines

Configuration Examples

See the examples/ directory for complete configuration examples:

  • examples/basic_valley.yaml: Simple valley setup
  • examples/enterprise_valley.yaml: Full enterprise configuration
  • examples/development.yaml: Development environment setup
  • examples/production.yaml: Production-ready configuration

Architecture

  • Valley: Main container managing campfires and infrastructure
  • Dock: Gateway for inter-valley communication
  • Campfire: Individual AI agent containers
  • Torch: Message format for inter-valley communication
  • Party Box: Storage system for attachments and payloads
  • MCP Broker: Redis-based message routing

Development

Requirements

  • Python 3.8+
  • Redis server (for MCP broker)
  • PyYAML, Pydantic, cryptography

Running Tests

pip install -e ".[dev]"
pytest

Additional Documentation

Support

If you encounter issues:

  1. Check the Troubleshooting Guide for common problems
  2. Review the Demo Guide for step-by-step execution instructions
  3. Use the simplified demo (simple_marketing_demo.py) to bypass MCP broker issues
  4. Check Docker container logs: docker-compose logs [service-name]

License

MIT License - see LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

campfirevalley-1.0.0.tar.gz (118.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

campfirevalley-1.0.0-py3-none-any.whl (104.5 kB view details)

Uploaded Python 3

File details

Details for the file campfirevalley-1.0.0.tar.gz.

File metadata

  • Download URL: campfirevalley-1.0.0.tar.gz
  • Upload date:
  • Size: 118.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.8

File hashes

Hashes for campfirevalley-1.0.0.tar.gz
Algorithm Hash digest
SHA256 fd97c68394ef6fe3ae72134d9f45cdb93fa25370940136bde5979567b948224d
MD5 55a5ca5c6c0c6974d91d66f71a5d5544
BLAKE2b-256 2e09c1c971eed99b5177e91bd0ae817150694bda1331b66ef82945c71301b906

See more details on using hashes here.

File details

Details for the file campfirevalley-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: campfirevalley-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 104.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.8

File hashes

Hashes for campfirevalley-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bd5434c59ff035515273aec1a3a4055f39fa3c35787b51328b23f4ff136ed068
MD5 ac25ca1ab371b0044b8a4446e1bcf878
BLAKE2b-256 68859b90e79b124dba0c34eed17739a792cb5295f5bfb71b8400352842d59976

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page