SynaptiQ Systems
  • Welcome SynaptiQ Systems
  • Getting Started
    • Overview: SynaptiQ Systems
    • Installation Guide: SynaptiQ Systems
  • Basics
    • YAML Configuration Filentitled
    • Modular Architecture: SynaptiQ Systems
    • Swarm Behavior: SynaptiQ Systems
    • SwarmConsensus: Collaborative Decision-Making in SynaptiQ Systems
    • Dynamic Breeding in SynaptiQ Systems
    • Democratic Decision-Making in SynaptiQ Systems
  • Multi-Agent Collaboration in SynaptiQ Systems
  • AI Agent in SynaptiQ Systems
  • Reinforcement Learning (Self-Optimization) in SynaptiQ Systems
  • IPFS for Decentralized Messaging in SynaptiQ Systems
  • Integrations in SynaptiQ Systems
  • Database and Storage Integrations
  • Blockchain Smart Contract Interaction
  • Blockchain Integration
  • Knowledge Graph Integration
  • Advanced Use Cases
  • API Documentation
  • Glossary
  • Output Overview
  • Security Practices
  • Roadmap
  • FAQ
  • Proof of Concept: Aether SynaptiQ Systems in Action
  • Github
Powered by GitBook
On this page
  1. Basics

YAML Configuration Filentitled

YAML Configuration File

Introduction

The SynaptiQ Systems framework uses a YAML configuration file (config.yaml) to manage its settings. This file centralizes all configuration options, making it easy to customize the behavior of the framework.

This section explains:

  • The purpose of the configuration file.

  • How to modify the settings.

  • Best practices for secure key management using environment variables.


Structure of config.yaml

Here’s an example config.yaml file with explanations for each section:

yamlCopy code# Environment settings
environment: development  # Options: development, staging, production

# AI Agent configuration
synaptiq:
  agent:
    id: 1                        # Unique ID for the agent
    role: "manager"              # Role of the agent (e.g., worker, explorer, coordinator)
    max_tasks: 10                # Maximum tasks the agent can handle at once

# LLM integration
llm:
  provider: "openai"             # Supported: openai, anthropic, ollama
  base_url: "https://api.openai.com"
  model: "gpt-4"
  api_timeout: 10                # Timeout for API calls in seconds
  retry_attempts: 3              # Retry attempts for failed requests

# Swarm Intelligence
swarm:
  redis:
    host: "localhost"            # Redis server hostname
    port: 6379                   # Redis server port
  consensus_threshold: 3         # Minimum votes needed to reach consensus

# Blockchain integration
blockchain:
  solana:
    rpc_url: "https://api.mainnet-beta.solana.com"
    wallet_path: "/path/to/solana-wallet.json"
  ethereum:
    rpc_url: "https://mainnet.infura.io/v3/${ETH_RPC_KEY}"  # Use environment variable for secure API key management

# Logging and Debugging
logging:
  level: "INFO"                  # Options: DEBUG, INFO, WARNING, ERROR, CRITICAL
  file: "logs/synaptiq.log"
  rotate_logs: true              # Rotate log files to prevent large sizes

Editing the Configuration File

  1. Open the config.yaml file:

    • Located in the root directory of the project.

  2. Update Settings:

    • Modify values according to your environment (e.g., development or production).

Example:

yamlCopy codeenvironment: production
swarm:
  redis:
    host: "prod-redis.example.com"
    password: "securepassword123"
  1. Add Environment-Specific Settings:

    • Use separate YAML files for development, staging, and production environments.

    • Load the appropriate file dynamically based on the environment:

pythonCopy codeimport os
env = os.getenv("SYNAPTIQ_ENVIRONMENT", "development")
config_file = f"config.{env}.yaml"

Using Environment Variables

For sensitive data (e.g., API keys, Redis passwords), use environment variables instead of hardcoding them in the YAML file.

Steps:

  1. Add environment variables to a .env file during development:

bashCopy codeSYNAPTIQ_LLM_PROVIDER=anthropic
SYNAPTIQ_SWARM_REDIS_PASSWORD=securepassword123
ETH_RPC_KEY=your_infura_project_key
  1. Use these variables in the YAML file:

yamlCopy codeblockchain:
  ethereum:
    rpc_url: "https://mainnet.infura.io/v3/${ETH_RPC_KEY}"
  1. Load environment variables dynamically in code:

pythonCopy codeimport os
ethereum_rpc = os.getenv("ETH_RPC_KEY")

Best Practices

  • Don’t Hardcode Sensitive Data: Always use environment variables for API keys, passwords, and other secrets.

  • Use Separate YAML Files for Environments: Create config.development.yaml, config.staging.yaml, and config.production.yaml.

  • Document Your Changes: If you add new configuration options, ensure they are documented in this section.


Example Workflow

Here’s an example workflow to set up your configuration:

  1. Set the Environment:

bashCopy codeSYNAPTIQ_ENVIRONMENT=production
  1. Edit the YAML File: Update paths, hostnames, or thresholds based on your needs.

  2. Run the Framework:

bashCopy codepython main.py --config=config.production.yaml

Common Issues

  1. Missing Configuration File:

    • Error: FileNotFoundError: config.yaml not found.

    • Solution: Ensure the config.yaml file is in the correct directory or specify the path explicitly.

  2. Missing Environment Variables:

    • Error: API key for openai not found.

    • Solution: Add the required environment variables or use a .env file.

  3. Invalid YAML Syntax:

    • Error: yaml.scanner.ScannerError

    • Solution: Validate your YAML file using an online YAML linter.

PreviousInstallation Guide: SynaptiQ SystemsNextModular Architecture: SynaptiQ Systems

Last updated 5 months ago