Skip to content
Daydreams Logo

MIT License

Daydreams is a powerful generative agent library for executing anything onchain. It is chain agnostic and can be used to perform tasks - by simply injecting context with api documentation. Whether you're building on Base, Solana, Ethereum, Starknet, or other chains, Daydreams has you covered.

Think of it as an opinionated framework for building next generation agents.

Key Features

  • 🤖 Chain Agnostic - Works with any blockchain through simple context injection
  • 🧠 Chain of Thought Processing - Sophisticated reasoning engine for complex decision making
  • 🔄 Flexible Handler System - Easy to compose input, action, and output handlers
  • 💾 Built-in Memory - Vector database integration for experience storage and retrieval
  • 🎯 Goal-Oriented - Hierarchical goal planning and execution
  • 🤝 Multi-Agent Ready - Built for swarm intelligence and agent collaboration

Generative Framework

Unlike traditional frameworks that require explicit integrations, Daydreams uses a generative approach where the agent dynamically creates and executes actions through Chain of Thought processing. This means:

  • Zero-Shot Integration: Agents can interact with new protocols without pre-built integrations
  • Dynamic Function Creation: Actions are generated on-the-fly based on context and goals
  • Adaptive Behavior: Agents learn and evolve strategies through experience
  • Minimal Setup: Just provide context and goals - the agent figures out the rest

LLM Support

Daydreams supports all major LLM providers and open source models:

  • OpenRouter: Access to the latest open source models (Mistral, Llama, DeepSeek, etc.)
  • OpenAI: o1, o1-mini
  • Anthropic: Claude 3.5 Sonnet
  • Google: Gemini
  • Custom: Bring your own LLM implementation

Architecture

At its core, Daydreams is built around a simple yet powerful concept: everything is an IO (Input/Output) operation. The Orchestrator acts as the central nervous system, managing a stream of IO handlers that can be composed together for maximum speed and flexibility.

// Everything in Daydreams is an IO handler
type IOHandler = {
  name: string;
  role: "input" | "output" | "action";
  handler: (payload: any) => Promise<any>;
  schema: z.ZodSchema;
};

This IO-centric design means you can:

  • Easily plug in new capabilities through handlers
  • Process multiple operations in parallel
  • Chain handlers together for complex workflows
  • Hot-swap components without rebuilding
  • Scale horizontally across multiple agents

Quick Start

Get started with Daydreams in minutes:

npm
npm install @daydreamsai/core

Basic Usage

Here's a simple example to get you started:

// Initialize LLM client
const llmClient = new LLMClient({
  model: "openrouter:deepseek/deepseek-r1-distill-llama-70b",
  temperature: 0.3,
});
 
// Initialize vector database for memory storage
const vectorDb = new ChromaVectorDB("twitter_agent", {
  chromaUrl: "http://localhost:8000",
  logLevel: loglevel,
});
 
// Create a Master Processor
const masterProcessor = new MasterProcessor(
  llmClient,
  defaultCharacter,
  loglevel
);
 
// Add message processor to master processor
// You can define as many processors as you want and the master will decide which one to use
masterProcessor.addProcessor([
  new MessageProcessor(llmClient, defaultCharacter, loglevel),
]);
 
// Initialize the orchestrator
const orchestrator = new Orchestrator(
  masterProcessor,
  makeFlowLifecycle(new MongoDb(), new ConversationManager(vectorDb)),
  {
    level: loglevel,
    enableColors: true,
    enableTimestamp: true,
  }
);
// Register an IO handler
orchestrator.registerIOHandler({
  name: "simple_action",
  role: "action",
  schema: z.object({
    message: z.string(),
  }),
  handler: async (payload) => {
    console.log(`Executing action: ${payload.message}`);
    return { success: true };
  },
});

Core Concepts

Daydreams is built around several key concepts:

Orchestrator

The central component that manages data flow, registers handlers, and maintains autonomous operation.

Handlers

Building blocks that process data and produce outputs:

  • Input Handlers: Process incoming data (messages, API webhooks)
  • Action Handlers: Execute operations and return results
  • Output Handlers: Produce side effects (sending messages, updating UI)

Chain of Thought

The reasoning engine that:

  • Plans strategies for achieving goals
  • Breaks down complex tasks
  • Executes actions
  • Learns from experiences

Memory System

Stores and retrieves experiences using vector databases for contextual decision making.