Getting Started
Build your first Daydreams agent.
⚠️ Warning: This is alpha software under active development. Expect frequent breaking changes and bugs. The API is not yet stable.
Overview
Daydreams is a framework for building autonomous AI agents. At its core, an agent analyzes incoming information (inputs), reasons about it using a Large Language Model (LLM), and decides on the next steps, which could be generating a response (output) or performing a task (action). The results of actions feed back into the agent's awareness, creating a continuous loop orchestrated by the LLM.
This allows you to build agents that can interact with various systems like blockchains, social media, APIs, and more, based on goals and context.
Installation
You can install the core Daydreams package and the CLI helper using npm or bun:
You will also need an LLM provider SDK, for example, OpenAI:
Make sure you have an OPENAI_API_KEY
environment variable set.
Core Concepts
Daydreams is built around a few key ideas:
- Agent: The central orchestrator that runs the main loop.
- Context: Manages the state and memory for a specific task or interaction (e.g., a chat session).
- Inputs: How agents receive information (e.g., CLI messages, API events).
- Outputs: How agents respond or send information out (e.g., CLI responses, tweets).
- Actions: Tasks agents can perform (e.g., calling an API, executing a transaction).
- Memory: How agents store and recall information (working memory, episodic memory).
Dive deeper into these in the Core Concepts section.
Your First Agent (CLI Echo Bot)
Let's create a simple agent that echoes back whatever you type in the command line.
1. Set up your project:
2. Create agent.ts
:
3. Run the agent:
Make sure your OPENAI_API_KEY
environment variable is set.
Now you can type messages, and the agent should echo them back using the CLI
input and output handlers provided by cliExtension
.
Next Steps: Explore the Core Concepts or check out the Guides for more complex examples.