Skip to content

API Reference

Complete reference for all Mamba Agents classes and functions.

Main Package

from mamba_agents import (
    # Core
    Agent,
    AgentConfig,
    AgentResult,
    AgentSettings,

    # Context
    CompactionConfig,
    CompactionResult,
    ContextState,

    # Tokens
    CostBreakdown,
    TokenUsage,
    UsageRecord,

    # Workflows
    Workflow,
    WorkflowConfig,
    WorkflowHooks,
    WorkflowResult,
    WorkflowState,
    WorkflowStep,

    # Prompts
    PromptConfig,
    PromptManager,
    PromptTemplate,
    TemplateConfig,

    # Messages
    MessageQuery, MessageStats, ToolCallInfo, Turn,

    # Display
    DisplayPreset, MessageRenderer,
    RichRenderer, PlainTextRenderer, HtmlRenderer,
    print_stats, print_timeline, print_tools,
)

Module Reference

Core

Module Description
Agent Core agent class and configuration
Config Settings and configuration classes

Features

Module Description
Context Context management and compaction
Tokens Token counting and cost estimation
Prompts Jinja2 prompt templates
Workflows Workflow orchestration
Tools Built-in tools

Integration

Module Description
MCP Model Context Protocol integration
Backends Model backend adapters

Infrastructure

Module Description
Errors Exceptions and error handling
Observability Logging and tracing

Import Patterns

# Core functionality
from mamba_agents import Agent, AgentConfig, AgentSettings

# Tools
from mamba_agents.tools import read_file, write_file, run_bash

# Workflows
from mamba_agents.workflows import ReActWorkflow, ReActConfig

# Context (advanced)
from mamba_agents.context import ContextManager, CompactionConfig

# Prompts
from mamba_agents.prompts import PromptManager, TemplateConfig

# Messages
from mamba_agents import MessageQuery, MessageStats

# Display
from mamba_agents import print_stats, print_timeline, print_tools
from mamba_agents.agent.display import get_preset, COMPACT, DETAILED, VERBOSE

# MCP
from mamba_agents.mcp import MCPClientManager, MCPServerConfig

# Backends
from mamba_agents.backends import create_ollama_backend, get_profile