709 lines
30 KiB
HTML
709 lines
30 KiB
HTML
|
|
<!DOCTYPE HTML>
|
||
|
|
<html lang="en" class="light sidebar-visible" dir="ltr">
|
||
|
|
<head>
|
||
|
|
<!-- Book generated using mdBook -->
|
||
|
|
<meta charset="UTF-8">
|
||
|
|
<title>Agent Registry & Coordination - VAPORA Platform Documentation</title>
|
||
|
|
|
||
|
|
|
||
|
|
<!-- Custom HTML head -->
|
||
|
|
|
||
|
|
<meta name="description" content="Comprehensive documentation for VAPORA, an intelligent development orchestration platform built entirely in Rust.">
|
||
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||
|
|
<meta name="theme-color" content="#ffffff">
|
||
|
|
|
||
|
|
<link rel="icon" href="../favicon.svg">
|
||
|
|
<link rel="shortcut icon" href="../favicon.png">
|
||
|
|
<link rel="stylesheet" href="../css/variables.css">
|
||
|
|
<link rel="stylesheet" href="../css/general.css">
|
||
|
|
<link rel="stylesheet" href="../css/chrome.css">
|
||
|
|
<link rel="stylesheet" href="../css/print.css" media="print">
|
||
|
|
|
||
|
|
<!-- Fonts -->
|
||
|
|
<link rel="stylesheet" href="../FontAwesome/css/font-awesome.css">
|
||
|
|
<link rel="stylesheet" href="../fonts/fonts.css">
|
||
|
|
|
||
|
|
<!-- Highlight.js Stylesheets -->
|
||
|
|
<link rel="stylesheet" id="highlight-css" href="../highlight.css">
|
||
|
|
<link rel="stylesheet" id="tomorrow-night-css" href="../tomorrow-night.css">
|
||
|
|
<link rel="stylesheet" id="ayu-highlight-css" href="../ayu-highlight.css">
|
||
|
|
|
||
|
|
<!-- Custom theme stylesheets -->
|
||
|
|
|
||
|
|
|
||
|
|
<!-- Provide site root and default themes to javascript -->
|
||
|
|
<script>
|
||
|
|
const path_to_root = "../";
|
||
|
|
const default_light_theme = "light";
|
||
|
|
const default_dark_theme = "dark";
|
||
|
|
</script>
|
||
|
|
<!-- Start loading toc.js asap -->
|
||
|
|
<script src="../toc.js"></script>
|
||
|
|
</head>
|
||
|
|
<body>
|
||
|
|
<div id="mdbook-help-container">
|
||
|
|
<div id="mdbook-help-popup">
|
||
|
|
<h2 class="mdbook-help-title">Keyboard shortcuts</h2>
|
||
|
|
<div>
|
||
|
|
<p>Press <kbd>←</kbd> or <kbd>→</kbd> to navigate between chapters</p>
|
||
|
|
<p>Press <kbd>S</kbd> or <kbd>/</kbd> to search in the book</p>
|
||
|
|
<p>Press <kbd>?</kbd> to show this help</p>
|
||
|
|
<p>Press <kbd>Esc</kbd> to hide this help</p>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
<div id="body-container">
|
||
|
|
<!-- Work around some values being stored in localStorage wrapped in quotes -->
|
||
|
|
<script>
|
||
|
|
try {
|
||
|
|
let theme = localStorage.getItem('mdbook-theme');
|
||
|
|
let sidebar = localStorage.getItem('mdbook-sidebar');
|
||
|
|
|
||
|
|
if (theme.startsWith('"') && theme.endsWith('"')) {
|
||
|
|
localStorage.setItem('mdbook-theme', theme.slice(1, theme.length - 1));
|
||
|
|
}
|
||
|
|
|
||
|
|
if (sidebar.startsWith('"') && sidebar.endsWith('"')) {
|
||
|
|
localStorage.setItem('mdbook-sidebar', sidebar.slice(1, sidebar.length - 1));
|
||
|
|
}
|
||
|
|
} catch (e) { }
|
||
|
|
</script>
|
||
|
|
|
||
|
|
<!-- Set the theme before any content is loaded, prevents flash -->
|
||
|
|
<script>
|
||
|
|
const default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? default_dark_theme : default_light_theme;
|
||
|
|
let theme;
|
||
|
|
try { theme = localStorage.getItem('mdbook-theme'); } catch(e) { }
|
||
|
|
if (theme === null || theme === undefined) { theme = default_theme; }
|
||
|
|
const html = document.documentElement;
|
||
|
|
html.classList.remove('light')
|
||
|
|
html.classList.add(theme);
|
||
|
|
html.classList.add("js");
|
||
|
|
</script>
|
||
|
|
|
||
|
|
<input type="checkbox" id="sidebar-toggle-anchor" class="hidden">
|
||
|
|
|
||
|
|
<!-- Hide / unhide sidebar before it is displayed -->
|
||
|
|
<script>
|
||
|
|
let sidebar = null;
|
||
|
|
const sidebar_toggle = document.getElementById("sidebar-toggle-anchor");
|
||
|
|
if (document.body.clientWidth >= 1080) {
|
||
|
|
try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { }
|
||
|
|
sidebar = sidebar || 'visible';
|
||
|
|
} else {
|
||
|
|
sidebar = 'hidden';
|
||
|
|
}
|
||
|
|
sidebar_toggle.checked = sidebar === 'visible';
|
||
|
|
html.classList.remove('sidebar-visible');
|
||
|
|
html.classList.add("sidebar-" + sidebar);
|
||
|
|
</script>
|
||
|
|
|
||
|
|
<nav id="sidebar" class="sidebar" aria-label="Table of contents">
|
||
|
|
<!-- populated by js -->
|
||
|
|
<mdbook-sidebar-scrollbox class="sidebar-scrollbox"></mdbook-sidebar-scrollbox>
|
||
|
|
<noscript>
|
||
|
|
<iframe class="sidebar-iframe-outer" src="../toc.html"></iframe>
|
||
|
|
</noscript>
|
||
|
|
<div id="sidebar-resize-handle" class="sidebar-resize-handle">
|
||
|
|
<div class="sidebar-resize-indicator"></div>
|
||
|
|
</div>
|
||
|
|
</nav>
|
||
|
|
|
||
|
|
<div id="page-wrapper" class="page-wrapper">
|
||
|
|
|
||
|
|
<div class="page">
|
||
|
|
<div id="menu-bar-hover-placeholder"></div>
|
||
|
|
<div id="menu-bar" class="menu-bar sticky">
|
||
|
|
<div class="left-buttons">
|
||
|
|
<label id="sidebar-toggle" class="icon-button" for="sidebar-toggle-anchor" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar">
|
||
|
|
<i class="fa fa-bars"></i>
|
||
|
|
</label>
|
||
|
|
<button id="theme-toggle" class="icon-button" type="button" title="Change theme" aria-label="Change theme" aria-haspopup="true" aria-expanded="false" aria-controls="theme-list">
|
||
|
|
<i class="fa fa-paint-brush"></i>
|
||
|
|
</button>
|
||
|
|
<ul id="theme-list" class="theme-popup" aria-label="Themes" role="menu">
|
||
|
|
<li role="none"><button role="menuitem" class="theme" id="default_theme">Auto</button></li>
|
||
|
|
<li role="none"><button role="menuitem" class="theme" id="light">Light</button></li>
|
||
|
|
<li role="none"><button role="menuitem" class="theme" id="rust">Rust</button></li>
|
||
|
|
<li role="none"><button role="menuitem" class="theme" id="coal">Coal</button></li>
|
||
|
|
<li role="none"><button role="menuitem" class="theme" id="navy">Navy</button></li>
|
||
|
|
<li role="none"><button role="menuitem" class="theme" id="ayu">Ayu</button></li>
|
||
|
|
</ul>
|
||
|
|
<button id="search-toggle" class="icon-button" type="button" title="Search (`/`)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="/ s" aria-controls="searchbar">
|
||
|
|
<i class="fa fa-search"></i>
|
||
|
|
</button>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<h1 class="menu-title">VAPORA Platform Documentation</h1>
|
||
|
|
|
||
|
|
<div class="right-buttons">
|
||
|
|
<a href="../print.html" title="Print this book" aria-label="Print this book">
|
||
|
|
<i id="print-button" class="fa fa-print"></i>
|
||
|
|
</a>
|
||
|
|
<a href="https://github.com/vapora-platform/vapora" title="Git repository" aria-label="Git repository">
|
||
|
|
<i id="git-repository-button" class="fa fa-github"></i>
|
||
|
|
</a>
|
||
|
|
<a href="https://github.com/vapora-platform/vapora/edit/main/docs/src/../architecture/agent-registry-coordination.md" title="Suggest an edit" aria-label="Suggest an edit">
|
||
|
|
<i id="git-edit-button" class="fa fa-edit"></i>
|
||
|
|
</a>
|
||
|
|
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div id="search-wrapper" class="hidden">
|
||
|
|
<form id="searchbar-outer" class="searchbar-outer">
|
||
|
|
<input type="search" id="searchbar" name="searchbar" placeholder="Search this book ..." aria-controls="searchresults-outer" aria-describedby="searchresults-header">
|
||
|
|
</form>
|
||
|
|
<div id="searchresults-outer" class="searchresults-outer hidden">
|
||
|
|
<div id="searchresults-header" class="searchresults-header"></div>
|
||
|
|
<ul id="searchresults">
|
||
|
|
</ul>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<!-- Apply ARIA attributes after the sidebar and the sidebar toggle button are added to the DOM -->
|
||
|
|
<script>
|
||
|
|
document.getElementById('sidebar-toggle').setAttribute('aria-expanded', sidebar === 'visible');
|
||
|
|
document.getElementById('sidebar').setAttribute('aria-hidden', sidebar !== 'visible');
|
||
|
|
Array.from(document.querySelectorAll('#sidebar a')).forEach(function(link) {
|
||
|
|
link.setAttribute('tabIndex', sidebar === 'visible' ? 0 : -1);
|
||
|
|
});
|
||
|
|
</script>
|
||
|
|
|
||
|
|
<div id="content" class="content">
|
||
|
|
<main>
|
||
|
|
<h1 id="-agent-registry--coordination"><a class="header" href="#-agent-registry--coordination">🤖 Agent Registry & Coordination</a></h1>
|
||
|
|
<h2 id="multi-agent-orchestration-system"><a class="header" href="#multi-agent-orchestration-system">Multi-Agent Orchestration System</a></h2>
|
||
|
|
<p><strong>Version</strong>: 0.1.0
|
||
|
|
<strong>Status</strong>: Specification (VAPORA v1.0 - Multi-Agent)
|
||
|
|
<strong>Purpose</strong>: Sistema de registro, descubrimiento y coordinación de agentes</p>
|
||
|
|
<hr />
|
||
|
|
<h2 id="-objetivo"><a class="header" href="#-objetivo">🎯 Objetivo</a></h2>
|
||
|
|
<p>Crear un <strong>marketplace de agentes</strong> donde:</p>
|
||
|
|
<ul>
|
||
|
|
<li>✅ 12 roles especializados trabajan en paralelo</li>
|
||
|
|
<li>✅ Cada agente tiene capacidades, dependencias, versiones claras</li>
|
||
|
|
<li>✅ Discovery & instalación automática</li>
|
||
|
|
<li>✅ Health monitoring + auto-restart</li>
|
||
|
|
<li>✅ Inter-agent communication via NATS JetStream</li>
|
||
|
|
<li>✅ Shared context via MCP/RAG</li>
|
||
|
|
</ul>
|
||
|
|
<hr />
|
||
|
|
<h2 id="-los-12-roles-de-agentes"><a class="header" href="#-los-12-roles-de-agentes">📋 Los 12 Roles de Agentes</a></h2>
|
||
|
|
<h3 id="tier-1-technical-core-código"><a class="header" href="#tier-1-technical-core-código">Tier 1: Technical Core (Código)</a></h3>
|
||
|
|
<p><strong>Architect</strong> (Role ID: <code>architect</code>)</p>
|
||
|
|
<ul>
|
||
|
|
<li>Responsabilidad: Diseño de sistemas, decisiones arquitectónicas</li>
|
||
|
|
<li>Entrada: Task de feature compleja, contexto de proyecto</li>
|
||
|
|
<li>Salida: ADRs, design documents, architecture diagrams</li>
|
||
|
|
<li>LLM óptimo: Claude Opus (complejidad alta)</li>
|
||
|
|
<li>Trabajo: Individual o iniciador de workflows</li>
|
||
|
|
<li>Canales: Publica decisiones, consulta Decision-Maker</li>
|
||
|
|
</ul>
|
||
|
|
<p><strong>Developer</strong> (Role ID: <code>developer</code>)</p>
|
||
|
|
<ul>
|
||
|
|
<li>Responsabilidad: Implementación de código</li>
|
||
|
|
<li>Entrada: Especificación, ADR, task asignada</li>
|
||
|
|
<li>Salida: Código, artifacts, PR</li>
|
||
|
|
<li>LLM óptimo: Claude Sonnet (velocidad + calidad)</li>
|
||
|
|
<li>Trabajo: Paralelo (múltiples developers por tarea)</li>
|
||
|
|
<li>Canales: Escucha de Architect, reporta a Reviewer</li>
|
||
|
|
</ul>
|
||
|
|
<p><strong>Reviewer</strong> (Role ID: <code>code-reviewer</code>)</p>
|
||
|
|
<ul>
|
||
|
|
<li>Responsabilidad: Revisión de calidad, standards</li>
|
||
|
|
<li>Entrada: Pull requests, código propuesto</li>
|
||
|
|
<li>Salida: Comments, aprobación/rechazo, sugerencias</li>
|
||
|
|
<li>LLM óptimo: Claude Sonnet o Gemini (análisis rápido)</li>
|
||
|
|
<li>Trabajo: Paralelo (múltiples reviewers)</li>
|
||
|
|
<li>Canales: Escucha PRs de Developer, reporta a Decision-Maker si crítico</li>
|
||
|
|
</ul>
|
||
|
|
<p><strong>Tester</strong> (Role ID: <code>tester</code>)</p>
|
||
|
|
<ul>
|
||
|
|
<li>Responsabilidad: Testing, benchmarks, QA</li>
|
||
|
|
<li>Entrada: Código implementado</li>
|
||
|
|
<li>Salida: Test code, benchmark reports, coverage metrics</li>
|
||
|
|
<li>LLM óptimo: Claude Sonnet (genera tests)</li>
|
||
|
|
<li>Trabajo: Paralelo</li>
|
||
|
|
<li>Canales: Escucha de Reviewer, reporta a DevOps</li>
|
||
|
|
</ul>
|
||
|
|
<h3 id="tier-2-documentation--communication"><a class="header" href="#tier-2-documentation--communication">Tier 2: Documentation & Communication</a></h3>
|
||
|
|
<p><strong>Documenter</strong> (Role ID: <code>documenter</code>)</p>
|
||
|
|
<ul>
|
||
|
|
<li>Responsabilidad: Documentación técnica, root files, ADRs</li>
|
||
|
|
<li>Entrada: Código, decisions, análisis</li>
|
||
|
|
<li>Salida: Docs en <code>docs/</code>, actualizaciones README/CHANGELOG</li>
|
||
|
|
<li>Usa: Root Files Keeper + doc-lifecycle-manager</li>
|
||
|
|
<li>LLM óptimo: GPT-4 (mejor formato)</li>
|
||
|
|
<li>Trabajo: Async, actualiza continuamente</li>
|
||
|
|
<li>Canales: Escucha cambios en repo, publica docs</li>
|
||
|
|
</ul>
|
||
|
|
<p><strong>Marketer</strong> (Role ID: <code>marketer</code>)</p>
|
||
|
|
<ul>
|
||
|
|
<li>Responsabilidad: Marketing content, messaging</li>
|
||
|
|
<li>Entrada: Nuevas features, releases</li>
|
||
|
|
<li>Salida: Blog posts, social content, press releases</li>
|
||
|
|
<li>LLM óptimo: Claude Sonnet (creatividad)</li>
|
||
|
|
<li>Trabajo: Async</li>
|
||
|
|
<li>Canales: Escucha releases, publica content</li>
|
||
|
|
</ul>
|
||
|
|
<p><strong>Presenter</strong> (Role ID: <code>presenter</code>)</p>
|
||
|
|
<ul>
|
||
|
|
<li>Responsabilidad: Presentaciones, slides, demos</li>
|
||
|
|
<li>Entrada: Features, arquitectura, roadmaps</li>
|
||
|
|
<li>Salida: Slidev presentations, demo scripts</li>
|
||
|
|
<li>LLM óptimo: Claude Sonnet (format + creativity)</li>
|
||
|
|
<li>Trabajo: On-demand, por eventos</li>
|
||
|
|
<li>Canales: Consulta Architect/Developer</li>
|
||
|
|
</ul>
|
||
|
|
<h3 id="tier-3-operations--infrastructure"><a class="header" href="#tier-3-operations--infrastructure">Tier 3: Operations & Infrastructure</a></h3>
|
||
|
|
<p><strong>DevOps</strong> (Role ID: <code>devops</code>)</p>
|
||
|
|
<ul>
|
||
|
|
<li>Responsabilidad: CI/CD, deploys, infrastructure</li>
|
||
|
|
<li>Entrada: Code approved, deployment requests</li>
|
||
|
|
<li>Salida: Manifests K8s, deployment logs, rollback</li>
|
||
|
|
<li>LLM óptimo: Claude Sonnet (IaC)</li>
|
||
|
|
<li>Trabajo: Paralelo deploys</li>
|
||
|
|
<li>Canales: Escucha de Reviewer (approved), publica deploy logs</li>
|
||
|
|
</ul>
|
||
|
|
<p><strong>Monitor</strong> (Role ID: <code>monitor</code>)</p>
|
||
|
|
<ul>
|
||
|
|
<li>Responsabilidad: Health checks, alerting, observability</li>
|
||
|
|
<li>Entrada: Deployment events, metrics</li>
|
||
|
|
<li>Salida: Alerts, dashboards, incident reports</li>
|
||
|
|
<li>LLM óptimo: Gemini Flash (análisis rápido)</li>
|
||
|
|
<li>Trabajo: Real-time, continuous</li>
|
||
|
|
<li>Canales: Publica alerts, escucha todo</li>
|
||
|
|
</ul>
|
||
|
|
<p><strong>Security</strong> (Role ID: <code>security</code>)</p>
|
||
|
|
<ul>
|
||
|
|
<li>Responsabilidad: Security analysis, compliance, audits</li>
|
||
|
|
<li>Entrada: Code changes, PRs, config</li>
|
||
|
|
<li>Salida: Security reports, CVE checks, audit logs</li>
|
||
|
|
<li>LLM óptimo: Claude Opus (análisis profundo)</li>
|
||
|
|
<li>Trabajo: Async, on PRs críticos</li>
|
||
|
|
<li>Canales: Escucha de Reviewer, puede bloquear PRs</li>
|
||
|
|
</ul>
|
||
|
|
<h3 id="tier-4-management--coordination"><a class="header" href="#tier-4-management--coordination">Tier 4: Management & Coordination</a></h3>
|
||
|
|
<p><strong>ProjectManager</strong> (Role ID: <code>project-manager</code>)</p>
|
||
|
|
<ul>
|
||
|
|
<li>Responsabilidad: Roadmaps, task tracking, coordination</li>
|
||
|
|
<li>Entrada: Completed tasks, metrics, blockers</li>
|
||
|
|
<li>Salida: Roadmap updates, task assignments, status reports</li>
|
||
|
|
<li>LLM óptimo: Claude Sonnet (análisis datos)</li>
|
||
|
|
<li>Trabajo: Async, agregador</li>
|
||
|
|
<li>Canales: Publica status, escucha completions</li>
|
||
|
|
</ul>
|
||
|
|
<p><strong>DecisionMaker</strong> (Role ID: <code>decision-maker</code>)</p>
|
||
|
|
<ul>
|
||
|
|
<li>Responsabilidad: Decisiones en conflictos, aprobaciones críticas</li>
|
||
|
|
<li>Entrada: Reportes de agentes, decisiones pendientes</li>
|
||
|
|
<li>Salida: Aprobaciones, resolución de conflictos</li>
|
||
|
|
<li>LLM óptimo: Claude Opus (análisis nuanced)</li>
|
||
|
|
<li>Trabajo: On-demand, decisiones críticas</li>
|
||
|
|
<li>Canales: Escucha escalaciones, publica decisiones</li>
|
||
|
|
</ul>
|
||
|
|
<p><strong>Orchestrator</strong> (Role ID: <code>orchestrator</code>)</p>
|
||
|
|
<ul>
|
||
|
|
<li>Responsabilidad: Coordinación de agentes, assignment de tareas</li>
|
||
|
|
<li>Entrada: Tasks a hacer, equipo disponible, constraints</li>
|
||
|
|
<li>Salida: Task assignments, workflow coordination</li>
|
||
|
|
<li>LLM óptimo: Claude Opus (planejamiento)</li>
|
||
|
|
<li>Trabajo: Continuous, meta-agent</li>
|
||
|
|
<li>Canales: Coordina todo, publica assignments</li>
|
||
|
|
</ul>
|
||
|
|
<hr />
|
||
|
|
<h2 id="-agent-registry-structure"><a class="header" href="#-agent-registry-structure">🏗️ Agent Registry Structure</a></h2>
|
||
|
|
<h3 id="agent-metadata-surrealdb"><a class="header" href="#agent-metadata-surrealdb">Agent Metadata (SurrealDB)</a></h3>
|
||
|
|
<pre><pre class="playground"><code class="language-rust"><span class="boring">#![allow(unused)]
|
||
|
|
</span><span class="boring">fn main() {
|
||
|
|
</span>pub struct AgentMetadata {
|
||
|
|
pub id: String, // "architect", "developer-001"
|
||
|
|
pub role: AgentRole, // Architect, Developer, etc
|
||
|
|
pub name: String, // "Senior Architect Agent"
|
||
|
|
pub version: String, // "0.1.0"
|
||
|
|
pub status: AgentStatus, // Active, Inactive, Updating, Error
|
||
|
|
|
||
|
|
pub capabilities: Vec<Capability>, // [Design, ADR, Decisions]
|
||
|
|
pub skills: Vec<String>, // ["rust", "kubernetes", "distributed-systems"]
|
||
|
|
pub llm_provider: LLMProvider, // Claude, OpenAI, Gemini, Ollama
|
||
|
|
pub llm_model: String, // "opus-4"
|
||
|
|
|
||
|
|
pub dependencies: Vec<String>, // Agents this one depends on
|
||
|
|
pub dependents: Vec<String>, // Agents that depend on this one
|
||
|
|
|
||
|
|
pub health_check: HealthCheckConfig,
|
||
|
|
pub max_concurrent_tasks: u32,
|
||
|
|
pub current_tasks: u32,
|
||
|
|
pub queue_depth: u32,
|
||
|
|
|
||
|
|
pub created_at: DateTime<Utc>,
|
||
|
|
pub last_health_check: DateTime<Utc>,
|
||
|
|
pub uptime_percentage: f64,
|
||
|
|
}
|
||
|
|
|
||
|
|
pub enum AgentRole {
|
||
|
|
Architect, Developer, CodeReviewer, Tester,
|
||
|
|
Documenter, Marketer, Presenter,
|
||
|
|
DevOps, Monitor, Security,
|
||
|
|
ProjectManager, DecisionMaker, Orchestrator,
|
||
|
|
}
|
||
|
|
|
||
|
|
pub enum AgentStatus {
|
||
|
|
Active,
|
||
|
|
Inactive,
|
||
|
|
Updating,
|
||
|
|
Error(String),
|
||
|
|
Scaling,
|
||
|
|
}
|
||
|
|
|
||
|
|
pub struct Capability {
|
||
|
|
pub id: String, // "design-adr"
|
||
|
|
pub name: String, // "Architecture Decision Records"
|
||
|
|
pub description: String,
|
||
|
|
pub complexity: Complexity, // Low, Medium, High, Critical
|
||
|
|
}
|
||
|
|
|
||
|
|
pub struct HealthCheckConfig {
|
||
|
|
pub interval_secs: u32,
|
||
|
|
pub timeout_secs: u32,
|
||
|
|
pub consecutive_failures_threshold: u32,
|
||
|
|
pub auto_restart_enabled: bool,
|
||
|
|
}
|
||
|
|
<span class="boring">}</span></code></pre></pre>
|
||
|
|
<h3 id="agent-instance-runtime"><a class="header" href="#agent-instance-runtime">Agent Instance (Runtime)</a></h3>
|
||
|
|
<pre><pre class="playground"><code class="language-rust"><span class="boring">#![allow(unused)]
|
||
|
|
</span><span class="boring">fn main() {
|
||
|
|
</span>pub struct AgentInstance {
|
||
|
|
pub metadata: AgentMetadata,
|
||
|
|
pub pod_id: String, // K8s pod ID
|
||
|
|
pub ip: String,
|
||
|
|
pub port: u16,
|
||
|
|
pub start_time: DateTime<Utc>,
|
||
|
|
pub last_heartbeat: DateTime<Utc>,
|
||
|
|
pub tasks_completed: u32,
|
||
|
|
pub avg_task_duration_ms: u32,
|
||
|
|
pub error_count: u32,
|
||
|
|
pub tokens_used: u64,
|
||
|
|
pub cost_incurred: f64,
|
||
|
|
}
|
||
|
|
<span class="boring">}</span></code></pre></pre>
|
||
|
|
<hr />
|
||
|
|
<h2 id="-inter-agent-communication-nats"><a class="header" href="#-inter-agent-communication-nats">📡 Inter-Agent Communication (NATS)</a></h2>
|
||
|
|
<h3 id="message-protocol"><a class="header" href="#message-protocol">Message Protocol</a></h3>
|
||
|
|
<pre><pre class="playground"><code class="language-rust"><span class="boring">#![allow(unused)]
|
||
|
|
</span><span class="boring">fn main() {
|
||
|
|
</span>pub enum AgentMessage {
|
||
|
|
// Task assignment
|
||
|
|
TaskAssigned {
|
||
|
|
task_id: String,
|
||
|
|
agent_id: String,
|
||
|
|
context: TaskContext,
|
||
|
|
deadline: DateTime<Utc>,
|
||
|
|
},
|
||
|
|
TaskStarted {
|
||
|
|
task_id: String,
|
||
|
|
agent_id: String,
|
||
|
|
timestamp: DateTime<Utc>,
|
||
|
|
},
|
||
|
|
TaskProgress {
|
||
|
|
task_id: String,
|
||
|
|
agent_id: String,
|
||
|
|
progress_percent: u32,
|
||
|
|
current_step: String,
|
||
|
|
},
|
||
|
|
TaskCompleted {
|
||
|
|
task_id: String,
|
||
|
|
agent_id: String,
|
||
|
|
result: TaskResult,
|
||
|
|
tokens_used: u64,
|
||
|
|
duration_ms: u32,
|
||
|
|
},
|
||
|
|
TaskFailed {
|
||
|
|
task_id: String,
|
||
|
|
agent_id: String,
|
||
|
|
error: String,
|
||
|
|
retry_count: u32,
|
||
|
|
},
|
||
|
|
|
||
|
|
// Communication
|
||
|
|
RequestHelp {
|
||
|
|
from_agent: String,
|
||
|
|
to_roles: Vec<AgentRole>,
|
||
|
|
context: String,
|
||
|
|
deadline: DateTime<Utc>,
|
||
|
|
},
|
||
|
|
HelpOffered {
|
||
|
|
from_agent: String,
|
||
|
|
to_agent: String,
|
||
|
|
capability: Capability,
|
||
|
|
},
|
||
|
|
ShareContext {
|
||
|
|
from_agent: String,
|
||
|
|
to_roles: Vec<AgentRole>,
|
||
|
|
context_type: String, // "decision", "analysis", "code"
|
||
|
|
data: Value,
|
||
|
|
ttl_minutes: u32,
|
||
|
|
},
|
||
|
|
|
||
|
|
// Coordination
|
||
|
|
RequestDecision {
|
||
|
|
from_agent: String,
|
||
|
|
decision_type: String,
|
||
|
|
context: String,
|
||
|
|
options: Vec<String>,
|
||
|
|
},
|
||
|
|
DecisionMade {
|
||
|
|
decision_id: String,
|
||
|
|
decision: String,
|
||
|
|
reasoning: String,
|
||
|
|
made_by: String,
|
||
|
|
},
|
||
|
|
|
||
|
|
// Health
|
||
|
|
Heartbeat {
|
||
|
|
agent_id: String,
|
||
|
|
status: AgentStatus,
|
||
|
|
load: f64, // 0.0-1.0
|
||
|
|
},
|
||
|
|
}
|
||
|
|
|
||
|
|
// NATS Subjects (pub/sub pattern)
|
||
|
|
pub mod subjects {
|
||
|
|
pub const TASK_ASSIGNED: &str = "vapora.tasks.assigned"; // Broadcast
|
||
|
|
pub const TASK_PROGRESS: &str = "vapora.tasks.progress"; // Broadcast
|
||
|
|
pub const TASK_COMPLETED: &str = "vapora.tasks.completed"; // Broadcast
|
||
|
|
pub const AGENT_HELP: &str = "vapora.agent.help"; // Request/Reply
|
||
|
|
pub const AGENT_DECISION: &str = "vapora.agent.decision"; // Request/Reply
|
||
|
|
pub const AGENT_HEARTBEAT: &str = "vapora.agent.heartbeat"; // Broadcast
|
||
|
|
}
|
||
|
|
<span class="boring">}</span></code></pre></pre>
|
||
|
|
<h3 id="pubsub-patterns"><a class="header" href="#pubsub-patterns">Pub/Sub Patterns</a></h3>
|
||
|
|
<pre><pre class="playground"><code class="language-rust"><span class="boring">#![allow(unused)]
|
||
|
|
</span><span class="boring">fn main() {
|
||
|
|
</span>// 1. Broadcast: Task assigned to all interested agents
|
||
|
|
nats.publish("vapora.tasks.assigned", task_message).await?;
|
||
|
|
|
||
|
|
// 2. Request/Reply: Developer asks Help from Architect
|
||
|
|
let help_request = AgentMessage::RequestHelp { ... };
|
||
|
|
let response = nats.request("vapora.agent.help", help_request, Duration::from_secs(30)).await?;
|
||
|
|
|
||
|
|
// 3. Stream: Persist task completion for replay
|
||
|
|
nats.publish_to_stream("vapora_tasks", "vapora.tasks.completed", completion_message).await?;
|
||
|
|
|
||
|
|
// 4. Subscribe: Monitor listens all heartbeats
|
||
|
|
let mut subscription = nats.subscribe("vapora.agent.heartbeat").await?;
|
||
|
|
<span class="boring">}</span></code></pre></pre>
|
||
|
|
<hr />
|
||
|
|
<h2 id="-agent-discovery--installation"><a class="header" href="#-agent-discovery--installation">🏪 Agent Discovery & Installation</a></h2>
|
||
|
|
<h3 id="marketplace-api"><a class="header" href="#marketplace-api">Marketplace API</a></h3>
|
||
|
|
<pre><pre class="playground"><code class="language-rust"><span class="boring">#![allow(unused)]
|
||
|
|
</span><span class="boring">fn main() {
|
||
|
|
</span>pub struct AgentRegistry {
|
||
|
|
pub agents: HashMap<String, AgentMetadata>,
|
||
|
|
pub available_agents: HashMap<String, AgentManifest>, // Registry
|
||
|
|
pub running_agents: HashMap<String, AgentInstance>, // Runtime
|
||
|
|
}
|
||
|
|
|
||
|
|
pub struct AgentManifest {
|
||
|
|
pub id: String,
|
||
|
|
pub name: String,
|
||
|
|
pub version: String,
|
||
|
|
pub role: AgentRole,
|
||
|
|
pub docker_image: String, // "vapora/agents:developer-0.1.0"
|
||
|
|
pub resources: ResourceRequirements,
|
||
|
|
pub dependencies: Vec<AgentDependency>,
|
||
|
|
pub health_check_endpoint: String,
|
||
|
|
pub capabilities: Vec<Capability>,
|
||
|
|
pub documentation: String,
|
||
|
|
}
|
||
|
|
|
||
|
|
pub struct AgentDependency {
|
||
|
|
pub agent_id: String,
|
||
|
|
pub role: AgentRole,
|
||
|
|
pub min_version: String,
|
||
|
|
pub optional: bool,
|
||
|
|
}
|
||
|
|
|
||
|
|
impl AgentRegistry {
|
||
|
|
// Discover available agents
|
||
|
|
pub async fn list_available(&self) -> Vec<AgentManifest> {
|
||
|
|
self.available_agents.values().cloned().collect()
|
||
|
|
}
|
||
|
|
|
||
|
|
// Install agent
|
||
|
|
pub async fn install(
|
||
|
|
&mut self,
|
||
|
|
manifest: AgentManifest,
|
||
|
|
count: u32,
|
||
|
|
) -> anyhow::Result<Vec<AgentInstance>> {
|
||
|
|
// Check dependencies
|
||
|
|
for dep in &manifest.dependencies {
|
||
|
|
if !self.is_available(&dep.agent_id) && !dep.optional {
|
||
|
|
return Err(anyhow::anyhow!("Dependency {} required", dep.agent_id));
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
// Deploy to K8s (via Provisioning)
|
||
|
|
let instances = self.deploy_to_k8s(&manifest, count).await?;
|
||
|
|
|
||
|
|
// Register
|
||
|
|
for instance in &instances {
|
||
|
|
self.running_agents.insert(instance.metadata.id.clone(), instance.clone());
|
||
|
|
}
|
||
|
|
|
||
|
|
Ok(instances)
|
||
|
|
}
|
||
|
|
|
||
|
|
// Health monitoring
|
||
|
|
pub async fn monitor_health(&mut self) -> anyhow::Result<()> {
|
||
|
|
for (id, instance) in &mut self.running_agents {
|
||
|
|
let health = self.check_agent_health(instance).await?;
|
||
|
|
if !health.healthy {
|
||
|
|
if health.consecutive_failures >= instance.metadata.health_check.consecutive_failures_threshold {
|
||
|
|
if instance.metadata.health_check.auto_restart_enabled {
|
||
|
|
self.restart_agent(id).await?;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
Ok(())
|
||
|
|
}
|
||
|
|
}
|
||
|
|
<span class="boring">}</span></code></pre></pre>
|
||
|
|
<hr />
|
||
|
|
<h2 id="-shared-state--context"><a class="header" href="#-shared-state--context">🔄 Shared State & Context</a></h2>
|
||
|
|
<h3 id="context-management"><a class="header" href="#context-management">Context Management</a></h3>
|
||
|
|
<pre><pre class="playground"><code class="language-rust"><span class="boring">#![allow(unused)]
|
||
|
|
</span><span class="boring">fn main() {
|
||
|
|
</span>pub struct SharedContext {
|
||
|
|
pub project_id: String,
|
||
|
|
pub active_tasks: HashMap<String, Task>,
|
||
|
|
pub agent_states: HashMap<String, AgentState>,
|
||
|
|
pub decisions: HashMap<String, Decision>,
|
||
|
|
pub shared_knowledge: HashMap<String, Value>, // RAG indexed
|
||
|
|
}
|
||
|
|
|
||
|
|
pub struct AgentState {
|
||
|
|
pub agent_id: String,
|
||
|
|
pub current_task: Option<String>,
|
||
|
|
pub last_action: DateTime<Utc>,
|
||
|
|
pub available_until: DateTime<Utc>,
|
||
|
|
pub context_from_previous_tasks: Vec<String>,
|
||
|
|
}
|
||
|
|
|
||
|
|
// Access via MCP
|
||
|
|
impl SharedContext {
|
||
|
|
pub async fn get_context(&self, agent_id: &str) -> anyhow::Result<AgentState> {
|
||
|
|
self.agent_states.get(agent_id)
|
||
|
|
.cloned()
|
||
|
|
.ok_or(anyhow::anyhow!("Agent {} not found", agent_id))
|
||
|
|
}
|
||
|
|
|
||
|
|
pub async fn share_decision(&mut self, decision: Decision) -> anyhow::Result<()> {
|
||
|
|
self.decisions.insert(decision.id.clone(), decision);
|
||
|
|
// Notify interested agents via NATS
|
||
|
|
Ok(())
|
||
|
|
}
|
||
|
|
|
||
|
|
pub async fn share_knowledge(&mut self, key: String, value: Value) -> anyhow::Result<()> {
|
||
|
|
self.shared_knowledge.insert(key, value);
|
||
|
|
// Index in RAG
|
||
|
|
Ok(())
|
||
|
|
}
|
||
|
|
}
|
||
|
|
<span class="boring">}</span></code></pre></pre>
|
||
|
|
<hr />
|
||
|
|
<h2 id="-implementation-checklist"><a class="header" href="#-implementation-checklist">🎯 Implementation Checklist</a></h2>
|
||
|
|
<ul>
|
||
|
|
<li><input disabled="" type="checkbox"/>
|
||
|
|
Define AgentMetadata + AgentInstance structs</li>
|
||
|
|
<li><input disabled="" type="checkbox"/>
|
||
|
|
NATS JetStream integration</li>
|
||
|
|
<li><input disabled="" type="checkbox"/>
|
||
|
|
Agent Registry CRUD operations</li>
|
||
|
|
<li><input disabled="" type="checkbox"/>
|
||
|
|
Health monitoring + auto-restart logic</li>
|
||
|
|
<li><input disabled="" type="checkbox"/>
|
||
|
|
Agent marketplace UI (Leptos)</li>
|
||
|
|
<li><input disabled="" type="checkbox"/>
|
||
|
|
Installation flow (manifest parsing, K8s deployment)</li>
|
||
|
|
<li><input disabled="" type="checkbox"/>
|
||
|
|
Pub/Sub message handlers</li>
|
||
|
|
<li><input disabled="" type="checkbox"/>
|
||
|
|
Request/Reply pattern implementation</li>
|
||
|
|
<li><input disabled="" type="checkbox"/>
|
||
|
|
Shared context via MCP</li>
|
||
|
|
<li><input disabled="" type="checkbox"/>
|
||
|
|
CLI: <code>vapora agent list</code>, <code>vapora agent install</code>, <code>vapora agent scale</code></li>
|
||
|
|
<li><input disabled="" type="checkbox"/>
|
||
|
|
Logging + monitoring (Prometheus metrics)</li>
|
||
|
|
<li><input disabled="" type="checkbox"/>
|
||
|
|
Tests (mocking, integration)</li>
|
||
|
|
</ul>
|
||
|
|
<hr />
|
||
|
|
<h2 id="-success-metrics"><a class="header" href="#-success-metrics">📊 Success Metrics</a></h2>
|
||
|
|
<p>✅ Agents register and appear in registry
|
||
|
|
✅ Health checks run every N seconds
|
||
|
|
✅ Unhealthy agents restart automatically
|
||
|
|
✅ NATS messages route correctly
|
||
|
|
✅ Shared context accessible to all agents
|
||
|
|
✅ Agent scaling works (1 → N replicas)
|
||
|
|
✅ Task assignment < 100ms latency</p>
|
||
|
|
<hr />
|
||
|
|
<p><strong>Version</strong>: 0.1.0
|
||
|
|
<strong>Status</strong>: ✅ Specification Complete (VAPORA v1.0)
|
||
|
|
<strong>Purpose</strong>: Multi-agent registry and coordination system</p>
|
||
|
|
|
||
|
|
</main>
|
||
|
|
|
||
|
|
<nav class="nav-wrapper" aria-label="Page navigation">
|
||
|
|
<!-- Mobile navigation buttons -->
|
||
|
|
<a rel="prev" href="../../architecture/vapora-architecture.html" class="mobile-nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
|
||
|
|
<i class="fa fa-angle-left"></i>
|
||
|
|
</a>
|
||
|
|
|
||
|
|
<a rel="next prefetch" href="../../architecture/multi-ia-router.html" class="mobile-nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
|
||
|
|
<i class="fa fa-angle-right"></i>
|
||
|
|
</a>
|
||
|
|
|
||
|
|
<div style="clear: both"></div>
|
||
|
|
</nav>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<nav class="nav-wide-wrapper" aria-label="Page navigation">
|
||
|
|
<a rel="prev" href="../../architecture/vapora-architecture.html" class="nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
|
||
|
|
<i class="fa fa-angle-left"></i>
|
||
|
|
</a>
|
||
|
|
|
||
|
|
<a rel="next prefetch" href="../../architecture/multi-ia-router.html" class="nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
|
||
|
|
<i class="fa fa-angle-right"></i>
|
||
|
|
</a>
|
||
|
|
</nav>
|
||
|
|
|
||
|
|
</div>
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
<script>
|
||
|
|
window.playground_copyable = true;
|
||
|
|
</script>
|
||
|
|
|
||
|
|
|
||
|
|
<script src="../elasticlunr.min.js"></script>
|
||
|
|
<script src="../mark.min.js"></script>
|
||
|
|
<script src="../searcher.js"></script>
|
||
|
|
|
||
|
|
<script src="../clipboard.min.js"></script>
|
||
|
|
<script src="../highlight.js"></script>
|
||
|
|
<script src="../book.js"></script>
|
||
|
|
|
||
|
|
<!-- Custom JS scripts -->
|
||
|
|
|
||
|
|
|
||
|
|
</div>
|
||
|
|
</body>
|
||
|
|
</html>
|