Daydreams Agent Framework
A TypeScript framework for composing stateful agents with persistent memory, native MCP tools and pay-per-use model routing.
- Source repo
- daydreamsai/daydreams
- Stars
- ★ 626
- Last updated
- 1mo ago
- FARS reviewed
- Dec 01, 2026
- License
- MIT
- Primary language
- TypeScript
- FA score
- 41/100 · Major gaps
At a glance
- How it runs
- Works with
- Universal · cross-platformOpenAI API · Claude API
- Cost
- Free software; you pay for model usage
- Setup effort
- Low · running in minutes
- You'll need
- Typical use
- TypeScript teams building multi-customer support agents that need per-customer isolated memory and premium-only capabilities switched on by the
tierfield in the context schema. - Not a fit if
- Teams that need a long-term maintained agent harness — the README says this framework is no longer the core focus and points to lucid-agents plus the Pi harness
- Teams wanting a no-code or GUI builder — this is a TypeScript library you code against
- Situations where no external model calls or on-chain payments are allowed — model access needs either your own provider keys or the USDC-funded hosted router
- Website
- docs.daydreams.systems ↗ set on GitHub
- Maintenance
- Commits in the last 6 monthslast commit 2026-10-09
- Source review
- 41/100 · Major gaps 1 safety controls not found
What does this agent do, and when should you use it?
Daydreams is a TypeScript-first agent framework shipped as @daydreamsai/core, exposing createDreams, context, action and an extension system. Its organising idea is composable contexts: context() declares a Zod argument schema plus initial memory through create() and an optional render(), setActions() attaches typed actions, and .use() merges other contexts into a running agent — conditionally, based on the current context arguments. Memory is split into per-execution working memory and persistent context memory defined by create(), so state survives across sessions. @daydreamsai/mcp supplies createMcpExtension, which connects any MCP server over stdio or SSE and lets actions call external tools through ctx.callAction("mcp.callTool", …); platform packages exist for Discord, Twitter/X, Telegram, Supabase, Chroma, MongoDB and a CLI. Models can be passed as AI SDK instances or resolved through the OpenAI-compatible Dreams Router, which spans OpenAI, Anthropic, Google Vertex, Groq and xAI and supports x402 USDC payment per request. The README's own notice states that this framework is no longer the project's core focus, that its features are already obsolete, and recommends the lucid-agents repository together with the Pi agent harness instead.
You define a context with context({ type, schema, create, render }), attach actions via setActions([action({ name, description, schema, handler })]), and inside a handler read or write ctx.memory. createDreams({ model, contexts, extensions }) assembles model, contexts and extensions into an agent; agent.send({ context, args, input }) injects one user input, after which the framework picks and runs actions and writes results back into memory. .use((state) => [...]) composes sub-contexts at runtime depending on the current context arguments, so support, analytics and premium capabilities can answer in a single conversation. For tooling, createMcpExtension([{ id, transport }]) connects MCP servers over stdio or SSE, and actions reach external tools through ctx.callAction("mcp.listResources", { serverId }) or ctx.callAction("mcp.callTool", { serverId, name, arguments }). Model side, you pass an AI SDK instance such as openai("gpt-4o"), or a router string such as dreamsRouter("openai/gpt-4o") / dreamsRouter("anthropic/claude-3-5-sonnet-20241022"), configuring x402 USDC billing with createDreamsRouterAuth(account, { payments: { amount, network } }). The README claims runtimes covering Node.js, browsers, Deno, Bun and edge functions.
- TypeScript teams building multi-customer support agents that need per-customer isolated memory and premium-only capabilities switched on by the
tierfield in the context schema. - Developers who want an agent to read local files or query SQLite without writing tool glue — register
@modelcontextprotocol/server-filesystemandserver-sqlitethroughcreateMcpExtension. - API operators who need to resell model calls per request, using the documented x402 nanoservice example and
createDreamsRouterAuthUSDC billing. - Projects that want to swap between OpenAI, Anthropic, Google Vertex and Groq models without rewriting provider code, using
dreamsRouter("provider/model")strings. - Bot builders targeting Discord, Twitter/X or Telegram who want the official
@daydreamsai/*extensions attached to the same agent core. - Teams that need chat, game sessions and admin functions isolated inside one agent process, registered as separate
contextobjects oncreateDreams.
Key setup facts
Pulled from the install and usage notes below. The project README has the current values.
- Install / run
npm install @daydreamsai/core @ai-sdk/openai zodnpx create-daydreams-agent my-agent
How do you install or deploy this agent?
Install into an existing TypeScript project (the README quickstart path):
npm install @daydreamsai/core @ai-sdk/openai zodOr scaffold a complete project:
npx create-daydreams-agent my-agent
cd my-agent && npm run devTo build the monorepo from source (the README's development setup):
git clone https://github.com/daydreamsai/daydreams.git
cd daydreams
pnpm install
./scripts/build.sh --watch
bun run packages/corePrerequisites are a Node.js/npm toolchain (the README also claims Node.js, Bun, Deno, browsers and edge functions) plus model credentials for whatever you pass to createDreams — either your own provider API key or a Dreams Router account funded for x402 USDC payments. The README does not document the exact environment-variable names for provider keys; check the per-provider docs.
How do you use this agent?
Define a typed context with actions, create the agent, and send an input:
import { createDreams, context, action } from "@daydreamsai/core";
import { openai } from "@ai-sdk/openai";
import { z } from "zod";
const weatherContext = context({
type: "weather",
create: () => ({ lastQuery: null }),
}).setActions([
action({
name: "getWeather",
schema: z.object({ city: z.string() }),
handler: async ({ city }, ctx) => {
ctx.memory.lastQuery = city;
return { weather: `Sunny, 72°F in ${city}` };
},
}),
]);
const agent = createDreams({
model: openai("gpt-4o"),
contexts: [weatherContext],
});
await agent.send({
context: weatherContext,
input: "What's the weather in San Francisco?",
});Compose sub-contexts conditionally with .use() and attach MCP servers as extensions:
import { createMcpExtension } from "@daydreamsai/mcp";
const supportContext = context({
type: "support",
schema: z.object({ customerId: z.string(), tier: z.enum(["free", "premium"]) }),
}).use((state) => [
{ context: analyticsContext, args: { userId: state.args.customerId } },
...(state.args.tier === "premium" ? [{ context: premiumContext }] : []),
]);
const agentWithMcp = createDreams({
model: openai("gpt-4o"),
contexts: [supportContext],
extensions: [
createMcpExtension([
{
id: "filesystem",
transport: {
type: "stdio",
command: "npx",
args: ["@modelcontextprotocol/server-filesystem", "./docs"],
},
},
]),
],
});Or put every provider behind one gateway with x402 billing:
import { dreamsRouter } from "@daydreamsai/ai-sdk-provider";
const models = [
dreamsRouter("openai/gpt-4o"),
dreamsRouter("anthropic/claude-3-5-sonnet-20241022"),
dreamsRouter("google-vertex/gemini-2.5-flash"),
dreamsRouter("groq/llama-3.1-405b-reasoning"),
];
const { dreamsRouter: paidRouter } = await createDreamsRouterAuth(account, {
payments: { amount: "100000", network: "base-sepolia" }, // $0.10 per request
});Safety boundaries, hardening & integrations
Operational blast radius, source-verified safety controls, and first-run hardening steps before connecting this agent to real workspaces.
Declared capability surface (blast radius)
Can run terminal commands; pair with approval gates or container/OS sandboxing.
Modifies local files; work on a clean Git branch or dedicated worktree.
Makes outbound requests; verify telemetry settings and model data routing on private repos.
Inherits capabilities of connected MCP servers; audit third-party servers before enabling.
FARS trust-control audit
- rollback or recovery path — Back up first, or work on a git branch or snapshot, so its changes can be undone.
What are this agent's strengths and limitations?
- Context composition is a concrete differentiator:
.use((state) => [...])merges sub-contexts at runtime based on arguments, rather than just registering a flat list of tools. - Two-tier memory is explicit — working memory for a single execution, plus persistent context memory returned by
create()that survives restarts. - Native MCP support through
createMcpExtensionwith both stdio and SSE transports, callable from actions viactx.callAction("mcp.callTool", …). - Model layer is decoupled: any
@ai-sdk/*instance works, and the OpenAI-compatible Dreams Router covers OpenAI, Anthropic, Google Vertex, Groq and xAI with claimed automatic fallbacks. - TypeScript-first with Zod-validated action schemas, claimed to run on Node.js, Bun, Deno, browsers and edge functions.
- MIT licensed, with Discord, Twitter, Telegram, Supabase, Chroma, MongoDB and CLI extensions published as separate npm packages.
- Maintenance risk is stated in the README itself: the framework is "no longer the core focus" and its features are "already obsolete", with lucid-agents and the Pi agent harness recommended instead.
- TypeScript code only — there is no GUI or low-code builder.
- Model access always depends on an external service: your own provider API key, or the hosted router that settles payments in USDC (the example network is base-sepolia, a testnet).
- The README omits provider environment-variable names and publishes no release history or migration guide in-repo, so integration details must come from external docs.
- x402 and router billing add an on-chain payment dependency and a network requirement on top of normal model calls.
- The officially recommended path forward (lucid-agents + Pi) lives outside this repository, which caps how much should be invested here.
How does this agent compare with similar options?
The README names its own successors: daydreamsai/lucid-agents for Agentic Commerce, and the Pi agent harness in badlogic/pi-mono, which it recommends for building agents with lucid-agents embedded. Beyond that it only contrasts itself generically against "traditional AI frameworks" (monolithic design, memory resets between sessions, manual state management) without naming a specific competitor product.
Key facts side by side with the most closely related agents.
| Agent | Source review | Form / cost | Stars | Updated | Language | Full support on |
|---|---|---|---|---|---|---|
| Daydreams Agent Framework This agent | 41 · Major gaps | FrameworkFree + model costs | ★ 626 | 1mo ago | TypeScript | OpenAI API · Claude API |
| Hypha | 55 · Major gaps | Self-hosted serviceFree + model costs | ★ 452 | 16d ago | TypeScript | OpenAI API |
| Open Multi-Agent Canvas | 35 · Major gaps | Web appFree + model costs | ★ 566 | 6mo ago | TypeScript | — |
| FastMCP | 68 · Some gaps | Library / SDKFreemium | ★ 29k | today | Python | — |
How does FollowAgents rate this agent?
Why each dimension lost points
The evidence shows create-agent asks for confirmation before overwriting a non-empty directory, and SECURITY.md gives guidance on least privilege, secrets, transaction confirmation, and log redaction. However, the core framework has no verifiable permission sandbox, action confirmation, sensitive-data redaction, or rollback mechanism; MCP stdio examples can launch arbitrary commands; and external effects such as posting, database access, code execution, and on-chain transactions lack built-in guardrails. Therefore least_privilege, user_confirmation, sensitive_data_handling, dependency_security, external_effects, and source_attribution are scored 1, rollback is 0, and data_flow_transparency is 2 because CLAUDE.md documents context, working memory, persistence, and execution flow in useful detail.
README and CLAUDE.md broadly agree on architecture, and package.json plus CI support the monorepo build and test story. But the README notice says the agent harness is no longer the core focus and features are obsolete, while the same README still uses strong claims such as first, enterprise-grade, and HIPAA-ready; naming and test commands also differ between create-agent and create-daydreams-agent. Dependencies are cataloged and pinned, but no lockfile evidence is in the packet and CI shows no audit step. Failure messages are clear mainly in create-agent, not in core execution. All three criteria are scored 1.
README clearly targets developers building TypeScript AI agents and lists e-commerce, healthcare, finance, and developer-tool scenarios, so audience_and_scenarios is scored 2. Capability boundaries rely mainly on an alpha warning and the top notice, without a systematic statement of supported runtimes, models, or MCP behavior; trigger_precision is limited to the CLI input loop and exit command; environment_fit claims Node, browser, Deno, Bun, and edge support while CI covers only Bun on Ubuntu. The other three criteria are scored 1.
README is well structured with quick start and development commands, so information_architecture and install_notes are scored 2. SECURITY.md and the top notice provide alpha, obsolete, and non-production limitations, so known_limitations is scored 2. MIT is stated in README and metadata, so license is scored 2. However, create-agent versus create-daydreams-agent naming is inconsistent and the root version is 0.0.0, so naming_stability is 1; examples are linked but there is no FAQ, so examples_and_faq is 1; there is no CHANGELOG, so versioning_changelog is 0; maintenance responsibility is weakened by the project redirecting focus to other repositories and by the absence of a maintainers file, so it is scored 1.
README provides readable API examples, a CLI, and a scaffolder, so output_usability is scored 2. But the top notice explicitly says the agent harness is no longer the focus, features are obsolete, and other repositories are recommended, so marginal_value is scored 1. Cost considerations involve paid models, USDC micropayments, and many dependencies, but there is no cost, quota, or alternative guidance, so cost_benefit is scored 1.
README, CLAUDE.md, package.json, and CI corroborate the basic monorepo, core package, and build/test structure, so cross_source_corroboration is scored 2. However, marketing claims such as first, HIPAA-ready, 1,000+ developers, and companies using have no traceable evidence, so claim_traceability is scored 1. README mixes facts, vision, and marketing, so fact_inference_separation is scored 1.
- Not found in source: rollback or recovery pathBack up first, or work on a git branch or snapshot, so its changes can be undone.
- Static review only; no code was executed, so build, tests, and runtime behavior are unverified.
- MCP stdio examples can launch arbitrary commands; no sandbox, action confirmation, or rate limiting is evident. External posting, database access, code execution, and on-chain transactions need caller-side guardrails.
- SECURITY.md is guidance, not enforced implementation; secret handling, log redaction, encrypted storage, and rollback remain adopter responsibilities.
- README states the agent harness is no longer the core focus and features are obsolete, recommending other repositories; assess maintenance status before adoption.
- Publisher identity is unverified. MIT is stated in README and metadata, but the referenced licence.md and package.json license field are not in the packet; verify the published package.
- Dependencies are pinned or cataloged, but no lockfile or CI audit step is shown; supply-chain risk needs independent review.
FAQ
Is this project still actively maintained?
What does it cost to run?
amount: "100000" as $0.10 per request on base-sepolia.Can I use my own model provider?
createDreams({ model }) accepts an AI SDK model instance such as openai("gpt-4o"); through the gateway, dreamsRouter("provider/model") covers openai, anthropic, google-vertex, groq and others.How does an agent reach files, databases or other external tools?
createMcpExtension from @daydreamsai/mcp (stdio for local processes, SSE for remote URLs), then call ctx.callAction("mcp.callTool", { serverId, name, arguments }) or ctx.callAction("mcp.listResources", { serverId }) inside an action.Which runtimes are supported?
Thanks — we use this to improve the page.
Subscribe to the FollowAgents RSS feed, or save this agent to your browser shortlist to compare on your next visit.