Building Blocks
The core components that make up a Daydreams agent.
Every Daydreams agent is built from four main building blocks. Think of them as the essential parts that work together to create intelligent behavior.
The Four Building Blocks
1. Inputs - How Your Agent Listens
Inputs are how your agent receives information from the outside world.
Examples:
- A Discord message arrives
- A user types in the CLI
- An API webhook gets called
- A timer goes off
2. Outputs - How Your Agent Speaks
Outputs are how your agent sends information back to the world.
Examples:
- Posting a message to Discord
- Printing to the console
- Sending an email
- Making an API call
3. Actions - What Your Agent Can Do
Actions are tasks your agent can perform to interact with systems or gather information.
Examples:
- Calling a weather API
- Reading from a database
- Processing a file
- Making calculations
4. Contexts - Your Agent's Workspace
Contexts define different "workspaces" or "modes" for your agent. Each context has its own memory and behavior.
Examples:
- A chat session with a specific user
- Playing a specific game
- Processing a specific document
- Managing a specific project
How They Work Together
Here's a simple flow showing how these building blocks connect:
- Input arrives → "New Discord message from user123"
- Agent thinks → "I should respond helpfully in this chat context"
- Agent acts → Calls the
getWeather
action if needed - Agent responds → Uses an output to send a reply
- Context remembers → Saves the conversation in chat context memory
The React Mental Model
If you know React, think of it this way:
- Contexts = React components (manage state and behavior)
- Actions = Event handlers (respond to interactions)
- Inputs/Outputs = Props/callbacks (data in and out)
- Agent = React app (orchestrates everything)
Next Steps
Now that you understand the building blocks, you can dive deeper into each one:
- Contexts - Learn how to manage state and memory
- Inputs - Set up ways for your agent to receive information
- Outputs - Configure how your agent responds
- Actions - Define what your agent can do
- Agent Lifecycle - Understand the complete execution flow