DREAMv1 API Reference

This reference documents all public modules, classes, and functions in the DREAMv1 framework. Use this as your guide for building applications with the DREAMv1 hierarchical multi-agent system.

Note: DREAMv1 is currently in active development. APIs may change between versions.

Master Control Program (MCP)

The Master Control Program orchestrates agent activities and manages system resources.

MasterControlProgram

Core controller class that manages the entire multi-agent system.

__init__(config=None)

Initialize a new Master Control Program instance.

Parameters:
  • config (dict, optional): Configuration dictionary or path to YAML config file.

register_agent(agent)

Register an agent with the MCP.

Parameters:
  • agent (Agent): Agent instance to register.
Returns:
  • str: Unique agent ID.

create_agent(agent_type, agent_config={})

Create and register a new agent of specified type.

Parameters:
  • agent_type (str): Type of agent to create.
  • agent_config (dict, optional): Configuration for the agent.
Returns:
  • Agent: The created agent instance.

start()

Start the MCP and all registered agents.

stop()

Stop the MCP and all registered agents.

get_agent(agent_id)

Retrieve an agent by its ID.

Parameters:
  • agent_id (str): ID of the agent to retrieve.
Returns:
  • Agent: The requested agent instance.

Agents

Agent classes that handle specific roles within the system.

Agent

Base agent class that all specific agent types inherit from.

__init__(agent_id=None, name=None, role=None)

Initialize a new agent.

Parameters:
  • agent_id (str, optional): Unique identifier for the agent. Generated if not provided.
  • name (str, optional): Human-readable name for the agent.
  • role (str, optional): Role description for this agent.

process_message(message)

Process an incoming message.

Parameters:
  • message (Message): The message to process.
Returns:
  • Message: Response message, if applicable.

send_message(receiver_id, content, message_type="default")

Send a message to another agent.

Parameters:
  • receiver_id (str): ID of the receiving agent.
  • content (any): Message content.
  • message_type (str, optional): Type of message.
Returns:
  • str: Message ID of the sent message.

ExecutiveAgent

High-level strategic agent that coordinates task delegation and goal management.

set_goals(goals)

Set system-level goals.

Parameters:
  • goals (list): List of goal descriptions.

SpecialistAgent

Domain-specific agent that handles tasks within its specialty area.

register_capability(capability_name, capability_function)

Register a new capability for this agent.

Parameters:
  • capability_name (str): Name of the capability.
  • capability_function (callable): Function that implements the capability.

Communication Protocol

Classes for handling inter-agent messaging and communication.

Message

Message class for inter-agent communication.

__init__(sender, receiver, message_type, content, priority="medium")

Initialize a new message.

Parameters:
  • sender (str): ID of the sending agent.
  • receiver (str): ID of the receiving agent.
  • message_type (str): Type of message.
  • content (any): Message content.
  • priority (str, optional): Priority level (low, medium, high, critical).

add_reference(message_id)

Add a reference to another message.

Parameters:
  • message_id (str): ID of the referenced message.

MessageBus

Central messaging system for routing messages between agents.

send(message)

Send a message through the message bus.

Parameters:
  • message (Message): The message to send.
Returns:
  • str: Message ID.

subscribe(agent_id, callback)

Subscribe an agent to receive messages.

Parameters:
  • agent_id (str): ID of the subscribing agent.
  • callback (callable): Function to call when a message is received.

Memory Systems

Memory management components for persisting agent knowledge and system state.

MemoryManager

Central system for managing different types of memory.

store(memory_type, key, value, metadata={})

Store a value in memory.

Parameters:
  • memory_type (str): Type of memory (working, long_term, etc.).
  • key (str): Key to store the value under.
  • value (any): Value to store.
  • metadata (dict, optional): Additional metadata about this memory.
Returns:
  • str: Memory entry ID.

retrieve(memory_type, key=None, query=None)

Retrieve values from memory.

Parameters:
  • memory_type (str): Type of memory to query.
  • key (str, optional): Exact key to retrieve.
  • query (dict, optional): Query parameters for searching.
Returns:
  • any: Retrieved value(s).

WorkingMemory

Short-term, volatile memory for active processing.

LongTermMemory

Persistent storage for important information.

Knowledge Base

Components for managing structured knowledge and information access.

KnowledgeBase

System for storing and retrieving structured knowledge.

add_entry(category, data)

Add a new knowledge entry.

Parameters:
  • category (str): Knowledge category.
  • data (dict): Knowledge data to store.
Returns:
  • str: Entry ID.

query(category=None, filters={})

Query the knowledge base.

Parameters:
  • category (str, optional): Category to query.
  • filters (dict, optional): Query filters.
Returns:
  • list: Matching knowledge entries.

Monitoring & Reflection

Components for system self-monitoring and introspection.

SystemMonitor

Monitors system performance and agent activities.

register_metric(metric_name, callback=None)

Register a new metric to track.

Parameters:
  • metric_name (str): Name of the metric.
  • callback (callable, optional): Function to compute metric value.

log_event(event_type, data)

Log a system event.

Parameters:
  • event_type (str): Type of event.
  • data (dict): Event data.

get_metrics(metric_names=None, time_range=None)

Get current metric values.

Parameters:
  • metric_names (list, optional): Names of metrics to retrieve.
  • time_range (tuple, optional): Start and end time for metric data.
Returns:
  • dict: Metric values.

Configuration

Utilities for system and agent configuration.

ConfigManager

Manages system and agent configurations.

load_config(config_path)

Load configuration from a file.

Parameters:
  • config_path (str): Path to the configuration file.
Returns:
  • dict: Loaded configuration.

get(section, key=None, default=None)

Get configuration values.

Parameters:
  • section (str): Configuration section.
  • key (str, optional): Specific configuration key.
  • default (any, optional): Default value if key doesn't exist.
Returns:
  • any: Configuration value.

set(section, key, value)

Set a configuration value.

Parameters:
  • section (str): Configuration section.
  • key (str): Configuration key.
  • value (any): Value to set.

Utilities

Helper functions and utilities for working with the DREAMv1 system.

Logger

System logging utility.

log(level, message, context={})

Log a message.

Parameters:
  • level (str): Log level (debug, info, warning, error, critical).
  • message (str): Log message.
  • context (dict, optional): Additional context information.

Serializer

Utilities for serializing and deserializing complex objects.

serialize(obj)

Serialize an object to a string format.

Parameters:
  • obj (any): Object to serialize.
Returns:
  • str: Serialized representation.

deserialize(data, target_type=None)

Deserialize data back into an object.

Parameters:
  • data (str): Serialized data.
  • target_type (type, optional): Expected type to deserialize into.
Returns:
  • any: Deserialized object.

Version History

Version Release Date Major Changes
0.1.0 In Development Initial release with core functionality