Architecture
Overview
Section titled “Overview”Viber is a lightweight, modular framework for building multi-agent AI applications. It provides the infrastructure for teams of AI agents to collaborate on complex tasks.
Core Concepts
Section titled “Core Concepts”An Agent is a specialized entity designed to perform specific tasks. Each agent has:
- Role Definition: Clear purpose defined by system prompt
- Tool Access: Set of tools it can use
- LLM Connection: Interface to language models
- Stateless Design: No memory between invocations (context provided at runtime)
A Space is an isolated workspace that encapsulates:
- Artifacts: Generated files and outputs
- History: Conversation and task logs
- Configuration: Space-specific settings
A Tool extends agent capabilities with:
- Schema Validation: Zod-based parameter validation
- Type Safety: Full TypeScript support
- Sandboxed Execution: Secure runtime environment
Layered Architecture
Section titled “Layered Architecture”┌─────────────────────────────────────────┐│ Application Layer ││ (React / Svelte / Vanilla JS) │├─────────────────────────────────────────┤│ Framework Adapters ││ (viber/react, viber/svelte) │├─────────────────────────────────────────┤│ Core Engine ││ (Agent, Space, Tool, Streaming) │├─────────────────────────────────────────┤│ LLM Providers ││ (OpenAI, Anthropic, Google, etc.) │└─────────────────────────────────────────┘Design Principles
Section titled “Design Principles”- Framework Agnostic: Core logic works with any UI framework
- Type-First: Full TypeScript support with Zod schemas
- Streaming Native: Real-time responses as first-class citizens
- Composable: Small, focused modules that combine flexibly
- Observable: Built-in event system for debugging and monitoring
Data Flow
Section titled “Data Flow”User Input ↓Agent.streamText() ↓┌─────────────┐│ LLM Call │ ←→ Tool Execution (if needed)└─────────────┘ ↓Stream Events → UI Updates ↓Space Persistence (artifacts, history)Multi-Agent Collaboration
Section titled “Multi-Agent Collaboration”Agents can collaborate through:
- Task Handoff: Natural language delegation
- Shared Spaces: Common artifact storage
- Event Bus: Cross-agent communication
const team = { lead: new Agent({ name: 'Lead', ... }), writer: new Agent({ name: 'Writer', ... }), reviewer: new Agent({ name: 'Reviewer', ... }),};