Dagentic: The Serverless Framework That Makes AI Agents Actually Work in Production
$ grep -n "^##" dagentic-the-serverless-framework-that-makes-ai-agents-actually-work-in-production.md>
- 1:The 3 AM Production Meltdown That Started Everything
- 11:Serverless-First, Because Agents Are Bursty
- 24:Self-Modifying DAGs
- 28:Traditional Static Workflow
- 45:Self-Modifying Workflow (AI Agent Reality)
- 177:Provider Agnosticism
- 196:AI-Powered Hierarchical Orchestration
- 219:The Economic Case
- 229:Current State: Early Preview
The 3 AM Production Meltdown That Started Everything
3:47 AM. Tuesday. My agentic AI system crashed—again.
The quarterly report that should have been automated is stuck in an infinite loop, burning $400/hour in OpenAI credits. The CEO wants to know why the "revolutionary AI agent" that worked perfectly in the demo can't handle production.
40% of agentic AI deployments fail, and I've watched this pattern repeat across multiple organizations. Most frameworks treat AI agents like traditional applications—predictable load, static architecture, linear execution. But agents are unpredictable, spiky workloads that modify themselves mid-execution, switch providers on the fly, and hold complex state across hours-long operations.
So I'm building Dagentic—a framework for how AI agents actually behave in production. Here's what that means.
Serverless-First, Because Agents Are Bursty
AI agents sit idle for hours, then spawn dozens of parallel tasks. GPU-heavy computation for one subtask, a simple API call for the next. Traditional frameworks assume the opposite—consistent, always-on, web-server load. Serverless inverts that: agents spin up exactly what they need, when they need it. A quarterly report might trigger:
- 12 research tasks across different regions
- 3 GPU-powered data analysis workflows
- 47 lightweight API orchestration functions
- 1 final assembly task
Each component scales independently. Each pays only for usage. My target moving off always-on architectures: 70-90% cost reduction.
But cost isn't the real breakthrough. It's persistent state. Traditional frameworks keep agent state in memory or files; when things crash—and they will—you lose everything. Dagentic stores every task, result, and decision in a database, so an agent that dies at 3 AM resumes exactly where it left off. No lost work, no intervention.
Self-Modifying DAGs
Most orchestration systems treat task graphs as immutable: define the workflow upfront, execute exactly that. AI agents don't work that way. They discover new requirements mid-execution, find better approaches, and need to replan dynamically. So Dagentic uses self-modifying DAGs—task graphs that agents restructure while running.
Traditional Static Workflow
Rendering diagram...
An assembly line: collect data, analyze it, write the report. Linear, predictable, unchangeable once started. Discover you need a compliance check mid-execution and you're out of luck—the process can't adapt.
Self-Modifying Workflow (AI Agent Reality)
Rendering diagram...
Mid-execution, the agent realizes EU and APAC regions have different compliance requirements it didn't anticipate. Instead of failing, it creates new compliance tasks and inserts a validation step to cross-reference findings. Three tasks become nine—restructured on discovered complexity.
const mainTask = await dagentic.createTask({
type: 'quarterly_report',
title: 'Generate Q4 Business Report',
canCreateSubtasks: true, // Enable AI-driven breakdown
priority: 5
});
// The agent analyzes the request and creates its own subtasks
const subtasks = await agent.planAndCreateSubtasks(mainTask.id);
// → Creates: market_research, financial_analysis, competitive_intel
// Mid-execution, the agent realizes it needs validation
const newVersion = await dagentic.replan(task.id, [{
action: 'create_tasks',
newTasks: [{
type: 'validation_task',
title: 'Validate Research Results',
priority: 4
}]
}], 'agent_detected_validation_need');
Rendering diagram...
In real deployments I've watched 12 predefined steps become 40+ dynamically generated tasks, each tailored to the context—agents adding compliance checks for regulations they only discovered while running.
Rendering diagram...
The point: agents that adapt to complexity they discover, not just what we anticipate.
Provider Agnosticism
Every AI team knows the scenario. You build everything around GPT-4. Then OpenAI changes pricing, or rate limits, or you discover Claude handles your case better. I've helped multiple teams through these migrations; traditional frameworks make them painful, with logic tightly coupled to one vendor's APIs and formats.
Dagentic treats providers as swappable components. Every interaction goes through a unified abstraction, so routing simple tasks to cheap models and complex analysis to premium ones is config, not code:
const providerConfig = {
simple: { provider: 'openai', model: 'gpt-4o-mini' },
complex: { provider: 'anthropic', model: 'claude-3-5-sonnet' },
specialized: { provider: 'groq', model: 'llama-3.1-70b' }
};
// Your agent code never changes
const result = await agent.process(task, { complexity: 'simple' });
A/B testing models, switching providers by region, fallback chains—all configuration. Teams route by cost, latency, and task type instead of rewriting agent logic every time a vendor moves.
AI-Powered Hierarchical Orchestration
Traditional workflow engines make humans break down complex tasks—every step and dependency defined upfront. Dagentic's orchestration engine is powered by AI itself: submit a high-level goal, and it builds a hierarchical breakdown with dependencies, schedules by resource availability, monitors progress, and handles failures with retry strategies.
The scheduler handles recurrence patterns, resource constraints, and cross-task dependencies:
const schedule = await dagentic.scheduleTask({
taskId: report.id,
pattern: '0 9 * * MON', // Every Monday at 9 AM
timezone: 'Asia/Singapore',
dependencies: ['data_sync', 'market_update'],
maxConcurrent: 3,
retryConfig: {
maxAttempts: 3,
backoffMs: 5000,
exponential: true
}
});
Better still: agents that schedule their own recurring work. One discovers that monthly competitive analysis improves its reports, and it adds that as a recurring task without anyone asking. I've watched "onboard new customer" evolve into 23 auto-generated subtasks, including compliance checks varying by geography.
The Economic Case
AI agents have to deliver measurable value. The patterns I'm targeting, from production deployments I've worked on:
- Loan processing agents handling 3x volume with 60% fewer human touches
- Routing optimization saving thousands of dev hours per quarter
- Onboarding workflows cutting 6-week processes to 2 days
And the infrastructure side. One project I consulted on went from $8,000/month to $800/month on the move to serverless—same performance, 90% cost cut. These aren't Dagentic results yet; they're the benchmarks I'm designing toward.
Current State: Early Preview
Full transparency: Dagentic is early preview. Working today: basic task creation and orchestration, the provider abstraction layer (OpenAI, Anthropic, Groq), persistent state, and a TypeScript-first developer experience. Still building: the self-modifying DAG engine, advanced scheduling, monitoring and cost analytics, enterprise security.
I'm sharing it now because the problems are real and I want feedback from teams hitting the same wall.
# Current preview installation
git clone https://github.com/dagentic/dagentic
cd dagentic && npm install
npm run dev
The code above shows the intended patterns; expect rough edges and missing pieces. This is early software from someone who's spent too much time debugging production agent failures.
The market is heading here fast—agentic AI is projected to grow from $7.06B in 2025 to $93.20B by 2032, and 61% of organizations are already building these systems. Almost all of them discover that demo code doesn't survive contact with business-critical processes. Every design decision in Dagentic—self-modifying DAGs, provider abstraction, persistent state—comes from a specific failure I hit moving an agent from proof-of-concept to production. The framework exists so the next one resumes at 3:47 AM instead of waking someone up.
Follow along at the Dagentic repository. It's early, but the problems it's tackling are very real.
The Cutler.sg Newsletter
Weekly notes on AI, engineering leadership, and building in Singapore. No fluff.
Scraper MCP: Context-Efficient Web Scraping for LLMs
I built an open-source MCP server that reduces LLM token usage by 70-90% through server-side HTML filtering, markdown conversion, and CSS selector targeting. Here's why context efficiency matters—and how Scraper MCP solves it.
Two Papers That Puncture the Hype
One paper shows frontier models degrade as context grows — even on trivial tasks. The other shows reasoning models hit a wall and think less as problems get harder. Read carefully, both point at the same engineering response.
The 30 Principles for Agentic Engineering — Part 5: Calibration and Reality
Principles 26–30. The calibration layer that catches what the rest of the framework would miss: a PR-noise budget, independent verification, model-swap regression discipline, the 15-tool-call rule, and protecting junior development.