What You Get
- -Agent task queue and scheduling
- -Persistent agent memory (Squish)
- -Role-based agent delegation
- -Workflow automation engine
- -Dashboard for monitoring
Step by Step
1. Define agent roles and permissions
Create an agent registry with roles: researcher (read/analyze), writer (create/edit), data-agent (query/manage data), ops-agent (execute actions). Each role has allowed tools and permission levels.
2. Build the task queue
Create a PostgreSQL-backed task queue. Fields: id, title, description, assigned_agent, priority (low/medium/high/urgent), status (pending/in_progress/done/failed), source (human/agent), created_at, completed_at.
3. Implement agent execution engine
Each agent is an LLM call wrapped with: task context, role instructions, allowed tools, and Squish memory access. Agents use ReAct loop: think, act, observe, repeat until task completion.
4. Add Squish memory integration
Configure Squish MCP server per agent. Agents automatically remember: completed tasks, user preferences, key decisions, and frequently used data. Memory is searchable across sessions.
5. Build workflow automation
Create a workflow engine: when task A is completed with status 'done', check workflow rules and trigger task B. Rules are defined as JSON: trigger_task, condition, target_agent, priority.
6. Implement human-in-the-loop
Flag sensitive actions (email sending, data deletion, payment actions) for human approval. Create an approval queue in the dashboard. Agents pause and wait for approval before proceeding.
7. Build the dashboard
Next.js dashboard showing: agent status (online/offline/busy), task queue with filters, memory stats (memories per agent, storage used), workflow runs history, and audit log.
Stack
Build This
Copy this prompt and paste it into Claude Code, OpenCode, Codex, or Cursor to build this recipe.
Common Failure Modes
- !Agent hallucinations from bad memory retrieval
- !Task queue bottlenecks
- !Permission escalation risks
- !Cost from constant LLM calls
Implementation Notes
Start with 2-3 agents. Monitor LLM costs closely. Implement rate limiting per agent. Audit log all agent actions.
Ship internal ai operating system in production with 4M Labs
4M Labs designs and ships applied AI systems -- connected to your tools, secured for your team, deployed with monitoring.
- Connected to your tools and data sources
- Secured for your team with proper access controls
- Deployed with monitoring and error handling
- Documented for handoff and future maintenance
Frequently Asked Questions
- Can I use this recipe in production?
- Yes. Every recipe is production-tested with error handling, logging, and deployment guidance.
- Which LLM providers are supported?
- Recipes support OpenAI, Anthropic Claude, Google Gemini, and open-source models via a unified interface.
- How do I customize these recipes?
- Each recipe includes a configuration section. Override model selection, API keys, and parameters without changing core logic.