Introduction
Understand the fundamental building blocks of the Daydreams framework.
The Daydreams framework is designed around a set of core concepts that work together to enable autonomous agent behavior. Understanding these concepts is key to effectively building and customizing agents.
Core Architecture
A Daydreams agent consists of several key components:
Contexts
Contexts are the foundation of a Daydreams agent. Similar to React components, contexts manage state and rendering for your agent. Each context:
- Has a defined schema for initialization
- Maintains its own memory state
- Provides a rendering function that formats its state for the LLM
Actions
Actions are functions that your agent can call to interact with its environment or modify its state. They're similar to event handlers in React:
Extensions
Extensions are pre-packaged bundles of inputs, outputs, and actions that add
specific capabilities to your agent. For example, the cli
extension adds
terminal input/output capabilities.
The React-like Mental Model
If you're familiar with React, you can think of Daydreams in similar terms:
- Contexts are like React components, managing state and rendering
- Actions are like event handlers, responding to inputs and updating state
- Extensions are like pre-built component libraries
- The agent itself is like a React application, orchestrating everything
This mental model makes it easy to reason about how your agent works and how to structure complex behaviors.
This section provides a detailed explanation of each fundamental component:
- Agent Lifecycle: How an agent processes information, makes decisions, and executes tasks in a continuous loop.
- Contexts: The mechanism for managing state, memory, and behavior for specific tasks or interactions.
- Actions: Definable tasks or capabilities that an agent can perform.
- Inputs: How agents receive data and trigger processing cycles.
- Outputs: How agents communicate results or send information to external systems.
- Memory: The different ways agents store, retrieve, and utilize information (Working, Episodic, Vector).
- Prompting: How instructions and context are formatted for the LLM to guide its reasoning.
- Tasks: The system for managing asynchronous operations and background tasks.
- Services & Extensions: How to integrate external services and extend the framework's capabilities.
Explore these pages to gain a deeper understanding of how Daydreams works under the hood.