Skip to content

bruno-core Documentation

Welcome to bruno-core - a modular, extensible foundation for building AI assistants.

Overview

bruno-core provides clean abstractions, swappable components, and a plugin architecture that enables you to build sophisticated conversational AI systems. It serves as the foundation layer that other Bruno packages build upon.

Key Features

  • 🧩 Modular Architecture - Clean separation between interfaces, implementations, and plugins
  • πŸ”Œ Plugin System - Easy registration via Python entry points
  • πŸ’¬ Conversation Management - Context windows, sessions, and state persistence
  • ⚑ Async-First - Built on asyncio for high-performance
  • 🎯 Action Execution - Parallel execution, rollback, and chaining
  • πŸ“Š Event System - Pub/sub for decoupled communication
  • πŸ§ͺ Well Tested - >80% code coverage
  • πŸ“ Type Safe - Full type hints and Pydantic validation

Getting Started

API Reference

Developer Guides

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚         Your Application                β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                  β–²
                  β”‚ uses
    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚             β”‚             β”‚          β”‚
β”Œβ”€β”€β”€β”΄β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”΄β”€β”€β”€β”€β” β”Œβ”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Custom β”‚  β”‚  Custom  β”‚  β”‚ Custom  β”‚ β”‚  Custom    β”‚
β”‚  LLM   β”‚  β”‚  Memory  β”‚  β”‚Abilitiesβ”‚ β”‚  Events    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
    β–²            β–²             β–²            β–²
    β”‚            β”‚             β”‚            β”‚
    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                  β”‚ implements
            β”Œβ”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”
            β”‚  bruno-    β”‚
            β”‚   core     β”‚
            β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Core Components

Interfaces

Abstract contracts that define how components interact: - AssistantInterface - Main orchestrator contract - LLMInterface - Language model provider contract - MemoryInterface - Storage backend contract - AbilityInterface - Ability/skill contract - EmbeddingInterface - Vector embedding contract

Base Implementations

Ready-to-extend base classes: - BaseAssistant - Default assistant implementation - BaseAbility - Ability template with validation - ActionExecutor - Action orchestration - ChainExecutor - Sequential ability execution

Models

Type-safe data structures: - Message - Chat messages with roles - ConversationContext - Message history - AbilityRequest/Response - Ability communication - MemoryEntry - Stored memories

Registry

Plugin discovery and management: - AbilityRegistry - Discover and load abilities - LLMProviderRegistry - Manage LLM providers - MemoryBackendRegistry - Manage storage backends

Context Management

  • ContextManager - Rolling message windows
  • SessionManager - Session lifecycle
  • StateManager - Persistent state storage

Events

Pub/sub event system: - EventBus - Event distribution - EventHandler - Base event handlers - Event types for all system activities

Example Usage

from bruno_core.base import BaseAssistant
from bruno_core.models import Message, MessageRole

# Initialize assistant
assistant = BaseAssistant(llm=your_llm, memory=your_memory)
await assistant.initialize()

# Process message
message = Message(role=MessageRole.USER, content="Hello!")
response = await assistant.process_message(
    message=message,
    user_id="user-123",
    conversation_id="conv-456"
)

print(response.text)

Package Structure

bruno_core/
β”œβ”€β”€ interfaces/      # Abstract contracts
β”œβ”€β”€ base/           # Base implementations
β”œβ”€β”€ models/         # Data models
β”œβ”€β”€ registry/       # Plugin system
β”œβ”€β”€ context/        # Context management
β”œβ”€β”€ events/         # Event system
β”œβ”€β”€ utils/          # Utilities
└── protocols/      # Type protocols

Contributing

See our Contributing Guide for development setup and guidelines.

License

MIT License - see LICENSE for details.

Support