### Start Development Services Source: https://github.com/thirdkeyai/symbiont/blob/main/docs/contributing.md Commands to launch required infrastructure services and verify the agent setup. ```bash # Start required services with Docker Compose docker-compose up -d redis postgres # Verify services are running cargo run --example basic_agent ``` -------------------------------- ### Local Development Setup (Bash) Source: https://github.com/thirdkeyai/symbiont/blob/main/docs/runtime-architecture.md Commands for setting up local development environment, including starting necessary dependencies like Redis and PostgreSQL with Docker Compose, running the application in development mode, and executing tests. ```bash # Start dependencies (LanceDB is embedded — no external service needed) docker-compose up -d redis postgres # Run in development mode RUST_LOG=debug cargo run --example full_system # Run tests cargo test --all --features test-utils ``` -------------------------------- ### Run Full System Demonstration Example Source: https://github.com/thirdkeyai/symbiont/blob/main/docs/getting-started.md Command to navigate to the runtime directory and execute the full system demonstration example using Cargo. ```bash cd crates/runtime && cargo run --example full_system ``` -------------------------------- ### Run Context and Memory Example Source: https://github.com/thirdkeyai/symbiont/blob/main/docs/getting-started.md Command to navigate to the runtime directory and execute the context and memory example using Cargo. ```bash cd crates/runtime && cargo run --example context_example ``` -------------------------------- ### Run Basic Agent Example Source: https://github.com/thirdkeyai/symbiont/blob/main/docs/getting-started.md Command to navigate to the runtime directory and execute the basic agent example using Cargo. ```bash cd crates/runtime && cargo run --example basic_agent ``` -------------------------------- ### Install Symbi-Gemini-CLI Extension Source: https://github.com/thirdkeyai/symbiont/blob/main/docs/getting-started.md Install the Symbi-Gemini-CLI extension from a GitHub repository using the `gemini extensions install` command. ```bash gemini extensions install https://github.com/thirdkeyai/symbi-gemini-cli ``` -------------------------------- ### Install Symbi using Install Script (macOS/Linux) Source: https://github.com/thirdkeyai/symbiont/blob/main/docs/getting-started.md Execute this script to install Symbi on macOS or Linux systems. ```bash curl -fsSL https://raw.githubusercontent.com/thirdkeyai/symbiont/main/scripts/install.sh | bash ``` -------------------------------- ### Run RAG-Powered Agent Example Source: https://github.com/thirdkeyai/symbiont/blob/main/docs/getting-started.md Command to navigate to the runtime directory and execute the RAG-powered agent example using Cargo. ```bash cd crates/runtime && cargo run --example rag_example ``` -------------------------------- ### Rust: Complete Symbiont Workflow Example Source: https://github.com/thirdkeyai/symbiont/blob/main/crates/runtime/docs/tool_review_workflow.md A comprehensive example in Rust demonstrating the complete Symbiont workflow. It covers initialization of components, submitting a tool for review, and monitoring its progress through various states until it's signed or rejected. ```rust use symbiont_runtime::integrations::tool_review::*; #[tokio::main] async fn main() -> Result<(), Box> { // Initialize components let context_manager = Arc::new(StandardContextManager::new(/* config */)); let rag_engine = Arc::new(StandardRAGEngine::new(context_manager)); let security_analyzer = Box::new(AISecurityAnalyzer::new(rag_engine, agent_id)); let review_interface = Box::new(StandardReviewInterface::new(config)); let schemapin_cli = Box::new(SchemaPinCliWrapper::new()?); // Create orchestrator let orchestrator = ToolReviewOrchestrator::new( security_analyzer, review_interface, schemapin_cli, ToolReviewConfig::default(), ); // Submit tool for review let tool = McpTool { name: "example-tool".to_string(), description: "Example tool for demonstration".to_string(), schema: serde_json::json!({ "type": "object", "properties": { "input": { "type": "string", "description": "Tool input" } }, "required": ["input"] }), provider: ToolProvider { name: "example-provider".to_string(), public_key_url: "https://example.com/pubkey.pem".to_string(), }, verification_status: VerificationStatus::Pending, metadata: None, }; let review_id = orchestrator.submit_tool(tool, "user@example.com".to_string()).await?; println!("Submitted tool for review: {}", review_id.0); // Monitor progress loop { let state = orchestrator.get_review_state(review_id).await?; println!("Current state: {:?}", state); match state { ToolReviewState::Signed { signature_info, .. } => { println!("Tool successfully signed!"); println!("Signature: {}", signature_info.signature); break; } ToolReviewState::Rejected { rejection_reason, .. } => { println!("Tool rejected: {}", rejection_reason); break; } _ => { tokio::time::sleep(Duration::from_secs(5)).await; } } } Ok(()) } ``` -------------------------------- ### Database Setup for Symbiont (SQL) Source: https://github.com/thirdkeyai/symbiont/blob/main/crates/runtime/docs/tool_review_workflow.md Creates a new PostgreSQL database and user for the Symbiont application. Ensure you have PostgreSQL installed and running. ```sql CREATE DATABASE symbiont_tool_review; CREATE USER symbiont_user WITH PASSWORD 'secure_password'; GRANT ALL PRIVILEGES ON DATABASE symbiont_tool_review TO symbiont_user; ``` -------------------------------- ### Delivery Routing Configuration Examples Source: https://github.com/thirdkeyai/symbiont/blob/main/docs/scheduling.md Provides examples of configuring different delivery channels for cron jobs. ```APIDOC ## Delivery Routing Configuration Examples ### Description Illustrates how to configure single, multiple, and specific delivery channels for Symbiont cron jobs. ### Examples **Single channel (LogFile):** ```symbiont schedule { name: "backup" agent: "backup-agent" cron: "0 0 3 * * *" delivery: ["log_file"] } ``` **Multiple channels (LogFile, Slack, Email):** ```symbiont schedule { name: "security-scan" agent: "scanner" cron: "0 0 1 * * *" delivery: ["log_file", "slack", "email"] slack_channel: "#security" email_recipients: ["ops@example.com", "security@example.com"] } ``` **Webhook delivery:** ```symbiont schedule { name: "metrics-report" agent: "metrics-agent" cron: "0 */30 * * * *" delivery: ["webhook"] webhook_url: "https://metrics.example.com/ingest" webhook_headers: { "Authorization": "Bearer ${METRICS_API_KEY}" "Content-Type": "application/json" } } ``` ``` -------------------------------- ### Run Symbiont Examples (Bash) Source: https://github.com/thirdkeyai/symbiont/blob/main/crates/runtime/README.md This snippet demonstrates how to run various examples provided by the Symbiont project using the cargo command-line tool. It covers examples for context and RAG, persistence testing, and a full system demonstration. ```bash cargo run --example context_example cargo run --example rag_example cargo run --example context_persistence_test cargo run --example full_system ``` -------------------------------- ### Setup Basic Reasoning Loop in Rust Source: https://context7.com/thirdkeyai/symbiont/llms.txt Demonstrates the setup of the core ORGA (Observe-Reason-Gate-Act) reasoning loop using default components. It includes defining conversation messages, tool definitions, and loop configuration for execution. This snippet requires the symbi-runtime crate. ```rust use std::sync::Arc; use symbi_runtime::reasoning::circuit_breaker::CircuitBreakerRegistry; use symbi_runtime::reasoning::context_manager::DefaultContextManager; use symbi_runtime::reasoning::conversation::{Conversation, ConversationMessage}; use symbi_runtime::reasoning::executor::DefaultActionExecutor; use symbi_runtime::reasoning::loop_types::{BufferedJournal, LoopConfig}; use symbi_runtime::reasoning::policy_bridge::DefaultPolicyGate; use symbi_runtime::reasoning::reasoning_loop::ReasoningLoopRunner; use symbi_runtime::reasoning::inference::ToolDefinition; use symbi_runtime::types::AgentId; // Set up the runner with default components let runner = ReasoningLoopRunner { provider: Arc::new(my_inference_provider), policy_gate: Arc::new(DefaultPolicyGate::permissive()), executor: Arc::new(DefaultActionExecutor::default()), context_manager: Arc::new(DefaultContextManager::default()), circuit_breakers: Arc::new(CircuitBreakerRegistry::default()), journal: Arc::new(BufferedJournal::new(1000)), knowledge_bridge: None, }; // Build a conversation with tool definitions let mut conv = Conversation::with_system("You are a helpful assistant."); conv.push(ConversationMessage::user("Search for Rust async best practices")); let config = LoopConfig { max_iterations: 10, tool_definitions: vec![ ToolDefinition { name: "web_search".into(), description: "Search the web for information".into(), parameters: serde_json::json!({ "type": "object", "properties": { "query": { "type": "string" } }, "required": ["query"] }), }, ], ..Default::default() }; // Run the loop let result = runner.run(AgentId::new(), conv, config).await; println!("Output: {}", result.output); println!("Iterations: {}", result.iterations); println!("Tokens used: {}", result.total_usage.total_tokens); ``` -------------------------------- ### Install Symbiont with Script Source: https://github.com/thirdkeyai/symbiont/blob/main/docs/index.md Use this script for installation on macOS or Linux systems. ```bash curl -fsSL https://symbiont.dev/install.sh | bash ``` -------------------------------- ### Install System Dependencies Source: https://github.com/thirdkeyai/symbiont/blob/main/docs/getting-started.md Installs required build tools and libraries for Ubuntu/Debian or macOS environments. ```bash # Ubuntu/Debian sudo apt-get update sudo apt-get install build-essential pkg-config libssl-dev # macOS brew install pkg-config openssl ``` -------------------------------- ### Symbiont SDK Examples Source: https://github.com/thirdkeyai/symbiont/blob/main/docs/scheduling.md Demonstrates how to use the Symbiont SDKs to interact with the scheduler for common tasks such as creating, listing, updating, and managing scheduled jobs. Includes examples for job execution control and status retrieval. ```javascript import { SymbiontClient } from '@symbiont/sdk-js'; const client = new SymbiontClient({ baseUrl: 'http://localhost:8080', apiKey: process.env.SYMBI_API_KEY }); // Create scheduled job const job = await client.schedule.create({ name: 'daily-backup', agentId: 'backup-agent', cronExpr: '0 0 2 * * *', sessionMode: 'ephemeral_with_summary', delivery: ['webhook'], webhookUrl: 'https://backup.example.com/notify' }); console.log(`Created job: ${job.id}`); // List active jobs const activeJobs = await client.schedule.list({ status: 'active' }); console.log(`Active jobs: ${activeJobs.length}`); // Get job status const status = await client.schedule.getStatus(job.id); console.log(`Next run: ${status.next_run}`); // Trigger immediate run await client.schedule.runNow(job.id, { input: 'Backup database' }); // Pause job await client.schedule.pause(job.id); // View history const history = await client.schedule.getHistory(job.id, { limit: 10 }); history.forEach(run => { console.log(`Run ${run.id}: ${run.status} (${run.execution_time_ms}ms)`); }); // Resume job await client.schedule.resume(job.id); // Delete job await client.schedule.delete(job.id); ``` ```python from symbiont import SymbiontClient client = SymbiontClient( base_url='http://localhost:8080', api_key=os.environ['SYMBI_API_KEY'] ) # Create scheduled job job = client.schedule.create( name='hourly-metrics', agent_id='metrics-agent', cron_expr='0 0 * * * *', session_mode='ephemeral_with_summary', delivery=['slack', 'log_file'], slack_channel='#metrics' ) print(f"Created job: {job.id}") # List jobs for specific agent jobs = client.schedule.list(agent_id='metrics-agent') print(f"Found {len(jobs)} jobs for metrics-agent") # Get job details details = client.schedule.get(job.id) print(f"Cron: {details.cron_expr}") print(f"Next run: {details.next_run}") # Update cron expression client.schedule.update(job.id, cron_expr='0 */30 * * * *') # Trigger immediate run run = client.schedule.run_now(job.id, input='Generate metrics report') print(f"Run ID: {run.id}") # Pause during maintenance client.schedule.pause(job.id) print("Job paused for maintenance") # View recent failures history = client.schedule.get_history( job.id, status='failed', limit=5 ) for run in history: print(f"Failed run {run.id}: {run.error_message}") # Resume after maintenance client.schedule.resume(job.id) # Check scheduler health health = client.schedule.health() print(f"Scheduler status: {health.status}") print(f"Active jobs: {health.active_jobs}") print(f"In-flight jobs: {health.in_flight_jobs}") ``` -------------------------------- ### Symbiont Configuration Example (TOML) Source: https://github.com/thirdkeyai/symbiont/blob/main/crates/runtime/docs/tool_review_workflow.md Example TOML configuration file for Symbiont, specifying database, Redis, Qdrant, and workflow settings. This file should be placed in the appropriate configuration directory. ```toml # config/tool_review.toml [database] url = "postgresql://symbiont_user:secure_password@localhost/symbiont_tool_review" max_connections = 20 [redis] url = "redis://localhost:6379" prefix = "symbiont:tool_review:" [qdrant] url = "http://localhost:6333" collection = "security_knowledge" [workflow] max_analysis_time_seconds = 300 max_human_review_time_seconds = 3600 auto_approve_threshold = 0.9 auto_reject_threshold = 0.1 max_signing_retries = 3 ``` -------------------------------- ### Initialize Development Environment Source: https://github.com/thirdkeyai/symbiont/blob/main/docs/contributing.md Commands to install Rust components and pre-commit hooks required for development. ```bash # Install Rust dependencies rustup update rustup component add rustfmt clippy # Install pre-commit hooks cargo install pre-commit pre-commit install # Build the project cargo build ``` -------------------------------- ### Install Symbi-Claude-Code Plugin Source: https://github.com/thirdkeyai/symbiont/blob/main/docs/getting-started.md Install the Symbi-Claude-Code plugin from a GitHub repository using the `marketplace add` command. ```bash /plugin marketplace add https://github.com/thirdkeyai/symbi-claude-code ``` -------------------------------- ### Start Symbiont Runtime Server (Bash) Source: https://github.com/thirdkeyai/symbiont/blob/main/docs/api-reference.md Starts the Symbiont runtime server with the HTTP API enabled. The server will listen for incoming HTTP requests. ```bash ./target/debug/symbiont-runtime --http-api ``` -------------------------------- ### Complete Workflow Example (Rust) Source: https://github.com/thirdkeyai/symbiont/blob/main/crates/runtime/docs/README.md An example Rust program demonstrating the complete tool review workflow, including initialization of components, submitting a tool, and polling for review completion. It utilizes the `tokio` runtime for asynchronous operations. ```rust #[tokio::main] async fn main() -> Result<(), Box> { // Initialize system components let orchestrator = ToolReviewOrchestrator::new( Box::new(AISecurityAnalyzer::new(rag_engine, agent_id)), Box::new(StandardReviewInterface::new(config)), Box::new(SchemaPinCliWrapper::new()?), ToolReviewConfig::default(), ); // Submit tool for review let review_id = orchestrator.submit_tool(tool, "user@example.com".to_string()).await?; // Wait for completion loop { match orchestrator.get_review_state(review_id).await? { ToolReviewState::Signed { .. } => { println!("✅ Tool successfully signed!"); break; } ToolReviewState::Rejected { rejection_reason, .. } => { println!("❌ Tool rejected: {}", rejection_reason); break; } _ => tokio::time::sleep(Duration::from_secs(1)).await, } } Ok(()) } ``` -------------------------------- ### Start Symbi MCP Server (Bash) Source: https://context7.com/thirdkeyai/symbiont/llms.txt Launches the Model Context Protocol (MCP) server, which facilitates tool integration with LLM clients. The server can be started using stdio transport or configured with a custom port, including via Docker. ```bash symbi mcp ``` ```bash docker run --rm -p 8080:8080 ghcr.io/thirdkeyai/symbi:latest mcp --port 8080 ``` -------------------------------- ### Symbiont Runtime Configuration Example Source: https://github.com/thirdkeyai/symbiont/blob/main/crates/runtime/README.md This TOML file provides a comprehensive example of configuring the Symbiont runtime. It covers settings for lifecycle management, resource allocation, context storage, vector databases, policy enforcement, and more. ```toml [lifecycle] initialization_timeout = "60s" termination_timeout = "30s" max_agents = 100 [resource] total_memory = 8589934592 # 8GB total_cpu_cores = 8 enforcement_enabled = true [context] storage_path = "./agent_contexts" enable_compression = true max_context_size_mb = 100 [vector_db] backend = "lancedb" # or "qdrant" data_path = "./data/vector_db" # LanceDB storage dir collection_name = "agent_knowledge" vector_dimension = 384 [mcp] verification_enabled = true connection_timeout = "30s" max_concurrent_connections = 10 [schemapin] binary_path = "/usr/local/bin/schemapin-cli" timeout = "30s" [policy] policy_file = "access_policies.yaml" enable_caching = true cache_ttl = "300s" [scheduler] max_concurrent_tasks = 100 load_balancing_strategy = "ResourceBased" [communication] enable_encryption = true max_message_size = 1048576 # 1MB [error_handler] enable_auto_recovery = true max_recovery_attempts = 3 # Optional HTTP API configuration (only used if http-api feature is enabled) [http_api] bind_address = "127.0.0.1" port = 8080 enable_cors = true enable_tracing = true ``` -------------------------------- ### TOML Configuration Example Source: https://github.com/thirdkeyai/symbiont/blob/main/crates/runtime/docs/README.md An example TOML configuration file demonstrating settings for workflow, security analysis, and review interfaces. These settings control various operational parameters of the system. ```toml [workflow] max_analysis_time_seconds = 300 max_human_review_time_seconds = 3600 auto_approve_threshold = 0.9 auto_reject_threshold = 0.1 max_signing_retries = 3 [security_analyzer] confidence_threshold = 0.6 include_low_severity = false max_rag_queries = 10 [review_interface] max_queue_size = 100 priority_boost_hours = 24 ``` -------------------------------- ### Start HTTP Input Server (Rust) Source: https://github.com/thirdkeyai/symbiont/blob/main/docs/http-input.md Configures and starts the HTTP Input server in Rust. It allows setting the bind address, port, path, authentication headers, audit logging, and CORS origins. It requires the symbiont-runtime crate and optionally accepts secrets configuration. ```rust use symbiont_runtime::http_input::{HttpInputConfig, start_http_input}; use symbiont_runtime::secrets::SecretsConfig; use std::sync::Arc; // Configure the HTTP input server let config = HttpInputConfig { bind_address: "127.0.0.1".to_string(), port: 8081, path: "/webhook".to_string(), agent: AgentId::from_str("webhook_handler")?, auth_header: Some("Bearer secret-token".to_string()), audit_enabled: true, cors_origins: vec!["https://example.com".to_string()], ..Default::default() }; // Optional: Configure secrets let secrets_config = SecretsConfig::default(); // Start the server start_http_input(config, Some(runtime), Some(secrets_config)).await?; ``` -------------------------------- ### Run Symbiont with Docker Source: https://github.com/thirdkeyai/symbiont/blob/main/docs/index.md Start the Symbiont runtime using Docker, exposing necessary ports. ```bash docker run --rm -p 8080:8080 -p 8081:8081 ghcr.io/thirdkeyai/symbi:latest up ``` -------------------------------- ### Verify Symbi Installation with Cargo Source: https://github.com/thirdkeyai/symbiont/blob/main/docs/getting-started.md Commands to test the DSL parser, runtime system, example agents, and the unified Symbi CLI after local installation. ```bash # Test the DSL parser cd crates/dsl && cargo run && cargo test # Test the runtime system cd ../runtime && cargo test # Run example agents cargo run --example basic_agent cargo run --example full_system # Test the unified symbi CLI cd ../.. && cargo run -- dsl --help cargo run -- mcp --help ``` -------------------------------- ### Initialize CedarPolicyGate Source: https://github.com/thirdkeyai/symbiont/blob/main/docs/ja/security-model.md Setup of the Cedar policy gate within the ReasoningLoopRunner, defaulting to a deny-all stance. ```rust use symbi_runtime::reasoning::cedar_gate::CedarPolicyGate; // デフォルト拒否のスタンスでCedarポリシーゲートを作成 let cedar_gate = CedarPolicyGate::deny_by_default(); let runner = ReasoningLoopRunner::builder() .provider(provider) .executor(executor) .policy_gate(Arc::new(cedar_gate)) .build(); ``` -------------------------------- ### Symbiont Built-in Functions Examples Source: https://github.com/thirdkeyai/symbiont/blob/main/docs/repl-guide.md Examples showcasing the usage of common Symbiont DSL built-in functions for printing, getting string length, case conversion, and string formatting. ```rust print("Hello", name) len("hello") upper("hello") lower("HELLO") format("Hello, {}!", name) ``` -------------------------------- ### Initialize a New Symbi Project Source: https://github.com/thirdkeyai/symbiont/blob/main/docs/getting-started.md Launches an interactive wizard to set up a new Symbi project with profile, SchemaPin mode, and sandbox tier selection. ```bash symbi init ``` -------------------------------- ### Start repl-cli in JSON-RPC Server Mode Source: https://github.com/thirdkeyai/symbiont/blob/main/crates/repl-cli/README.md Shows how to start the repl-cli as a JSON-RPC server, which communicates over stdio by default. It also includes an example of specifying an alternative communication method using a port number. ```bash # Start JSON-RPC server on stdio symbi repl --json-rpc # Specify alternative communication method symbi repl --json-rpc --port 9257 ``` -------------------------------- ### Get Schedule History (HTTP) Source: https://github.com/thirdkeyai/symbiont/blob/main/docs/api-reference.md Retrieves the execution history for a specific schedule, including start times, completion times, and status. Requires authentication. ```http GET /api/v1/schedules/{id}/history Authorization: Bearer ``` -------------------------------- ### Configure Authentication Methods Source: https://github.com/thirdkeyai/symbiont/blob/main/docs/http-input.md Examples for setting up security, including static bearer tokens, secret store references, and JWT public key validation. ```rust // Bearer Token let config = HttpInputConfig { auth_header: Some("Bearer your-secret-token".to_string()), ..Default::default() }; // Secret Store let config = HttpInputConfig { auth_header: Some("vault://webhook/auth_token".to_string()), ..Default::default() }; // JWT (EdDSA) let config = HttpInputConfig { jwt_public_key_path: Some("/path/to/jwt/ed25519-public.pem".to_string()), ..Default::default() }; ``` -------------------------------- ### Configure Advanced Primitives with LoopConfig Source: https://github.com/thirdkeyai/symbiont/blob/main/docs/reasoning-loop.md Example of how to configure advanced 'orga-adaptive' primitives such as Tool Profile and Pre-Hydration within the LoopConfig. This setup allows for glob-based filtering of tools and default pre-hydration settings. ```rust let config = LoopConfig { tool_profile: Some(ToolProfile::include_only(&["search_*", "file_*"])), pre_hydration: Some(PreHydrationConfig::default()), ..Default::default() }; ``` -------------------------------- ### Build and Run from Source Source: https://github.com/thirdkeyai/symbiont/blob/main/README.md Commands to compile the project from source and execute the runtime or REPL. ```bash cargo build --release ./target/release/symbi --help # Run the runtime cargo run -- up # Interactive REPL cargo run -- repl ``` -------------------------------- ### Setup Development Environment with Cargo Tools Source: https://github.com/thirdkeyai/symbiont/blob/main/crates/runtime/docs/README.md This bash script outlines the steps to set up the development environment for the Symbiont project using Cargo. It includes installing `cargo-watch` for development and `cargo-tarpaulin` for test coverage. It then demonstrates how to run tests with coverage and how to use `cargo-watch` to automatically re-run tests on code changes. ```bash # Install development dependencies cargo install cargo-watch cargo install cargo-tarpaulin # Run tests with coverage cargo tarpaulin --out html # Watch for changes during development cargo watch -x test ``` -------------------------------- ### KnowledgeBridge Setup Source: https://github.com/thirdkeyai/symbiont/blob/main/docs/reasoning-loop.md Initializes and sets up the `KnowledgeBridge` with a `ContextManager` and specific configuration for context items, relevance threshold, and auto-persistence. ```rust use symbi_runtime::reasoning::knowledge_bridge::{KnowledgeBridge, KnowledgeConfig}; let bridge = Arc::new(KnowledgeBridge::new( context_manager.clone(), // Arc KnowledgeConfig { max_context_items: 5, relevance_threshold: 0.3, auto_persist: true, }, )); let runner = ReasoningLoopRunner { // ... other fields ... knowledge_bridge: Some(bridge), }; ``` -------------------------------- ### Install Rust and Tree-sitter CLI Locally Source: https://github.com/thirdkeyai/symbiont/blob/main/crates/dsl/README.md Instructions for installing Rust and the Tree-sitter CLI locally, required for development outside of the Docker environment. It includes commands to download and run the Rust installer and install the Tree-sitter CLI globally via npm. ```bash # Install Rust curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh source ~/.cargo/env # Install Tree-sitter CLI npm install -g tree-sitter-cli # Install development tools cargo install cargo-watch cargo-edit cargo-audit ``` -------------------------------- ### Install Symbiont with Homebrew Source: https://github.com/thirdkeyai/symbiont/blob/main/docs/index.md Install Symbiont using Homebrew on macOS. ```bash brew tap thirdkeyai/tap brew install symbi ``` -------------------------------- ### Initialize a New Tool Manifest Source: https://github.com/thirdkeyai/symbiont/blob/main/docs/getting-started.md Use the `symbi tools init` command to create a starter manifest for a new tool. ```bash symbi tools init my_tool ``` -------------------------------- ### Example Symbi Agent Execution Source: https://github.com/thirdkeyai/symbiont/blob/main/docs/getting-started.md Demonstrates running the 'assistant' agent with a query and the 'recon.dsl' agent with a target IP and max iterations. ```bash symbi run assistant -i 'Summarize this document' symbi run agents/recon.dsl -i '{"target": "10.0.1.5"}' --max-iterations 5 ``` -------------------------------- ### Heartbeat Agent Example Source: https://github.com/thirdkeyai/symbiont/blob/main/docs/scheduling.md Example configuration for a heartbeat agent monitoring system metrics. ```APIDOC ## Heartbeat Agent Example ### Description This example demonstrates setting up a heartbeat agent named `heartbeat_monitor` that periodically checks system metrics and logs, taking action if issues are detected. ### Configuration ```symbiont agent heartbeat_monitor { model: "claude-sonnet-4.5" system_prompt: """ You are a system monitoring agent. On each heartbeat: 1. Check system metrics (CPU, memory, disk) 2. Review recent error logs 3. If issues detected, take action: - Restart services if safe - Alert ops team via Slack - Log incident details 4. Summarize findings 5. Return 'sleep' when done """ } schedule { name: "heartbeat-monitor" agent: "heartbeat_monitor" cron: "0 */10 * * * *" # Every 10 minutes heartbeat: { enabled: true context_mode: "ephemeral_with_summary" max_iterations: 50 } delivery: ["log_file", "slack"] slack_channel: "#ops-alerts" } ``` ``` -------------------------------- ### Build Qdrant Vector Backend Source: https://github.com/thirdkeyai/symbiont/blob/main/docs/pt/api-reference.md Builds the project with Qdrant vector database support. ```bash cargo build --features vector-qdrant ``` -------------------------------- ### Knowledge-Reasoning Bridge Setup Source: https://github.com/thirdkeyai/symbiont/blob/main/docs/reasoning-loop.md Demonstrates how to set up and integrate the `KnowledgeBridge` to connect the agent's knowledge store with the reasoning loop. ```APIDOC ## Knowledge-Reasoning Bridge ### Description The `KnowledgeBridge` facilitates the connection between the agent's knowledge store (including memory, knowledge bases, and vector search) and the core reasoning loop, enabling the agent to access and utilize its knowledge. ### Setup Example ```rust use std::sync::Arc; use symbi_runtime::reasoning::knowledge_bridge::{KnowledgeBridge, KnowledgeConfig}; // Assuming 'context_manager' is an instance of Arc let bridge = Arc::new(KnowledgeBridge::new( context_manager.clone(), KnowledgeConfig { max_context_items: 5, relevance_threshold: 0.3, auto_persist: true, }, )); // This bridge would then be part of the ReasoningLoopRunner configuration: // let runner = ReasoningLoopRunner { // // ... other fields ... // knowledge_bridge: Some(bridge), // }; ``` ### KnowledgeConfig Options - **`max_context_items`**: Maximum number of knowledge items to retrieve. - **`relevance_threshold`**: Minimum relevance score for retrieved items. - **`auto_persist`**: Whether to automatically persist knowledge changes. ``` -------------------------------- ### Import Catalog Agents during Symbi Initialization Source: https://github.com/thirdkeyai/symbiont/blob/main/docs/getting-started.md Demonstrates initializing a minimal project and then importing additional agents from the catalog. ```bash symbi init --profile minimal --no-interact symbi init --catalog assistant,dev ``` -------------------------------- ### Commit Message Examples Source: https://github.com/thirdkeyai/symbiont/blob/main/docs/contributing.md Examples of valid commit messages following the project's conventional commit standards. ```bash feat(runtime): add multi-tier sandbox support Implements Docker, gVisor, and Firecracker isolation tiers with automatic risk assessment and tier selection. Closes #123 fix(dsl): resolve parser error with nested policy blocks The parser was incorrectly handling nested policy definitions, causing syntax errors for complex security configurations. docs(security): update cryptographic implementation details Add detailed documentation for Ed25519 signature implementation and key management procedures. ``` -------------------------------- ### Local Symbi Installation and Testing Source: https://github.com/thirdkeyai/symbiont/blob/main/docs/getting-started.md Instructions for cloning the Symbi repository, building it locally using Cargo, and running tests. ```bash git clone https://github.com/thirdkeyai/symbiont.git cd symbiont cargo build --release cargo test ``` -------------------------------- ### Security: Capability Checking Example Source: https://github.com/thirdkeyai/symbiont/blob/main/docs/repl-guide.md Demonstrates how to define agent security blocks and require specific capabilities for behavior execution. ```APIDOC ## Security & Policy Enforcement ### Capability Checking The REPL enforces capability requirements defined in agent security blocks: #### Agent Definition with Capabilities ```rust agent SecureAgent { name: "Secure Agent" security { capabilities: ["filesystem", "network"] sandbox: true } } ``` #### Behavior Requiring Capabilities ```rust behavior ReadFile { input { path: string } output { content: string } steps { # This will check if agent has "filesystem" capability require capability("filesystem") # NOTE: read_file() is a planned built-in function (not yet implemented). # This example illustrates how capability checking works. let content = read_file(path) return content } } ``` ``` -------------------------------- ### Rust: Logging Best Practices with Tracing Source: https://github.com/thirdkeyai/symbiont/blob/main/crates/runtime/docs/tool_review_workflow.md Illustrates logging best practices in Rust using the `tracing` crate. It shows how to use `info!`, `warn!`, `error!`, and `instrument` macros for structured logging, including capturing context like `review_id`. ```rust use tracing::{info, warn, error, instrument}; #[instrument(skip(self), fields(review_id = %review_id))] async fn process_workflow(&self, review_id: ReviewId) -> ToolReviewResult<()> { info!("Starting workflow processing"); match self.execute_analysis(review_id).await { Ok(analysis) => { info!( risk_score = analysis.risk_score, findings_count = analysis.findings.len(), "Analysis completed successfully" ); } Err(e) => { error!(error = %e, "Analysis failed"); return Err(e); } } Ok(()) } ``` -------------------------------- ### Rust Unit Test Example Source: https://github.com/thirdkeyai/symbiont/blob/main/docs/contributing.md Example of a Rust unit test for policy evaluation. Ensure tests are fast and focus on individual functions or modules. ```rust #[cfg(test)] mod tests { use super::*; #[test] fn test_policy_evaluation() { let policy = Policy::new("test_policy", PolicyRules::default()); let context = PolicyContext::new(); let result = policy.evaluate(&context); assert_eq!(result, PolicyDecision::Allow); } } ``` -------------------------------- ### Clone and Configure Repository Source: https://github.com/thirdkeyai/symbiont/blob/main/docs/contributing.md Initial steps to fork, clone, and set up the upstream remote for the Symbiont repository. ```bash # Fork the repository on GitHub, then clone your fork git clone https://github.com/YOUR_USERNAME/symbiont.git cd symbiont # Add upstream remote git remote add upstream https://github.com/thirdkeyai/symbiont.git ``` -------------------------------- ### Start Symbiont Services (Bash) Source: https://github.com/thirdkeyai/symbiont/blob/main/crates/runtime/docs/tool_review_workflow.md Starts the Symbiont API server and workflow processor as separate processes. Ensure the configuration file is correctly set up. ```bash # Start API server cargo run --bin tool-review-api -- --config config/tool_review.toml # Start workflow processor (separate process) cargo run --bin workflow-processor -- --config config/tool_review.toml ``` -------------------------------- ### Rust Security Test Example Source: https://github.com/thirdkeyai/symbiont/blob/main/docs/contributing.md Example of a Rust security test for sandbox isolation. Security tests should verify controls, cryptographic operations, and attack scenarios. ```rust #[tokio::test] async fn test_sandbox_isolation() { let sandbox = create_test_sandbox(SecurityTier::Tier2).await; // Attempt to access restricted resource let result = sandbox.execute_malicious_code().await; // Should be blocked by security controls assert!(result.is_err()); assert_eq!(result.unwrap_err(), SandboxError::AccessDenied); } ``` -------------------------------- ### Rust Test Fixture Example Source: https://github.com/thirdkeyai/symbiont/blob/main/docs/contributing.md Example of a Rust function to create test agent configuration. Use consistent test data and avoid hardcoded values where possible. ```rust pub fn create_test_agent_config() -> AgentConfig { AgentConfig { id: AgentId::new(), name: "test_agent".to_string(), security_tier: SecurityTier::Tier1, memory_limit: 512 * 1024 * 1024, // 512MB capabilities: vec!["test".to_string()], policies: vec![], metadata: HashMap::new(), } } ``` -------------------------------- ### Basic Agent Creation and Initialization in Rust Source: https://github.com/thirdkeyai/symbiont/blob/main/crates/runtime/README.md Demonstrates the basic usage of the symbi-runtime in Rust. It shows how to create an AgentConfig with various settings and then instantiate an AgentInstance. The agent's ID and initial state are printed. ```rust use symbi_runtime::*; use std::time::Duration; #[tokio::main] async fn main() -> Result<(), Box> { // Create agent configuration let agent_config = AgentConfig { id: AgentId::new(), name: "example_agent".to_string(), dsl_source: "agent logic here".to_string(), execution_mode: ExecutionMode::Persistent, security_tier: SecurityTier::Tier2, resource_limits: ResourceLimits { memory_mb: 512, cpu_cores: 1.0, disk_io_mbps: 50, network_io_mbps: 10, execution_timeout: Duration::from_secs(3600), idle_timeout: Duration::from_secs(300), }, capabilities: vec![Capability::FileSystem, Capability::Network], policies: vec![], metadata: std::collections::HashMap::new(), priority: Priority::Normal, }; // Create and start agent let agent = AgentInstance::new(agent_config); println!("Agent {} created with state: {:?}", agent.id, agent.state); Ok(()) } ``` -------------------------------- ### Rust Integration Test Example Source: https://github.com/thirdkeyai/symbiont/blob/main/docs/contributing.md Example of a Rust integration test for agent lifecycle management. Integration tests should verify component interactions and can use real dependencies. ```rust #[tokio::test] async fn test_agent_lifecycle() { let runtime = test_runtime().await; let agent_config = AgentConfig::default(); let agent_id = runtime.create_agent(agent_config).await.unwrap(); let status = runtime.get_agent_status(agent_id).await.unwrap(); assert_eq!(status, AgentStatus::Ready); } ``` -------------------------------- ### Initialize Symbi Project (Bash) Source: https://context7.com/thirdkeyai/symbiont/llms.txt Scaffolds a new Symbiont project using an interactive wizard or non-interactively for CI/CD pipelines. Supports profile-based templates, security configurations (Schemapin, sandbox), and importing pre-built agents from a catalog. ```bash symbi init ``` ```bash symbi init --profile assistant --schemapin tofu --sandbox tier1 --no-interact ``` ```bash symbi init --catalog assistant,dev ``` ```bash symbi init --catalog list ``` -------------------------------- ### NLP Processor Agent Example Source: https://github.com/thirdkeyai/symbiont/blob/main/agents/README.md An example of how to use the NLP Processor agent to analyze customer feedback, performing tasks like sentiment analysis, entity extraction, and keyword identification. ```bash # Example: Analyze customer feedback echo '{ "text": "I love this product! The customer service was excellent and delivery was fast.", "tasks": ["sentiment", "entities", "keywords"] }' | cargo run --example basic_agent -- --agent agents/nlp_processor.dsl ``` -------------------------------- ### Build and Run Symbiont Runtime Source: https://github.com/thirdkeyai/symbiont/blob/main/agents/README.md Instructions for cloning the Symbiont repository, building the runtime using Cargo, and copying example agents. ```bash git clone https://github.com/thirdkeyai/symbiont.git cd symbiont # Build the runtime cargo build --release # Copy example agents to your workspace cp examples/agents/* ./agents/ ``` -------------------------------- ### Symbi Metadata Block Example Source: https://github.com/thirdkeyai/symbiont/blob/main/docs/dsl-guide.md Provides an example of a complete metadata block for a Symbi agent, showcasing various fields like version, author, description, license, tags, minimum runtime version, and dependencies. ```rust metadata { version: "1.2.0" author: "ThirdKey Security Team" description: "Healthcare data analysis agent with HIPAA compliance" license: "Proprietary" tags: ["healthcare", "hipaa", "analysis"] min_runtime_version: "1.0.0" dependencies: ["medical_nlp", "privacy_tools"] } ``` -------------------------------- ### Integrate External Systems Source: https://github.com/thirdkeyai/symbiont/blob/main/docs/dsl-guide.md Demonstrates how to integrate with external APIs, including setting timeouts, retry policies, and enforcing access control policies. ```rust agent api_integrator(request: APIRequest) -> APIResponse { capabilities: [api_access, data_transformation] policy api_access { allow: call(external_api) if api.rate_limit_ok require: valid_api_key audit: all_api_calls with response_codes } with timeout = 30.seconds, retry_policy = "exponential_backoff" { let response = call_external_api(request); return transform_response(response); } } ``` -------------------------------- ### JSON-RPC Error Response Example Source: https://github.com/thirdkeyai/symbiont/blob/main/crates/repl-cli/README.md An example of a JSON-RPC 2.0 error response, indicating an 'Invalid Request' with a specific error 'code', 'message', and additional 'data'. ```json { "jsonrpc": "2.0", "error": { "code": -32600, "message": "Invalid Request", "data": "Missing required parameter: input" }, "id": null } ``` -------------------------------- ### Basic Symbiont CLI Workflow Examples Source: https://github.com/thirdkeyai/symbiont/blob/main/crates/runtime/README-MCP-CLI.md Demonstrates fundamental operations of the Symbiont CLI, including adding a GitHub MCP server, listing servers, verifying server security, checking server status, and removing a server. ```bash # Add a GitHub MCP server symbiont-mcp add https://github.com/example/mcp-server # List all servers symbiont-mcp list --detailed # Verify server security symbiont-mcp verify example-mcp-server # Check server status symbiont-mcp status --name example-mcp-server --health-check # Remove server when no longer needed symbiont-mcp remove example-mcp-server ``` -------------------------------- ### Start Symbiont REPL Source: https://github.com/thirdkeyai/symbiont/blob/main/docs/repl-guide.md Commands to launch the Symbiont REPL in interactive mode or as a JSON-RPC server for IDE integration. Configuration is loaded from 'symbiont.toml'. ```bash symbi repl symbi repl --stdio ```