⚡
Stage 5 · Lesson 5 of 5

Scaling Your Architecture

Adding workflows, cost monitoring, and the path forward. You're now dangerous.

~15 min read8 walkthrough steps

You've built a complete AI agent infrastructure. Custom agents, structured memory, multi-agent workflows, production-grade automation. This final lesson is about scaling what you've built and avoiding the traps that catch people at this stage.

Adding workflows follows the pattern you've already mastered: new folder in projects/, orchestrator + subagents, route command in agents.md. Each workflow is independent. You can have 5, 10, 20 workflows running without any interference between them. The architecture scales linearly — complexity grows with the number of workflows, not exponentially.

Cost monitoring becomes critical as you scale. Every API call costs money, and automated agents running on schedules can accumulate costs quickly. Establish a monitoring practice: track daily API spend per workflow. Set spending alerts. Review cost per workflow monthly. Kill or optimize workflows that cost more than they deliver. A simple SQLite database tracking API calls per agent per day gives you everything you need.

Route vs Terminal decisions become more frequent as you add workflows. The default should always be the route method (shared workspace, simpler setup). Graduate to terminal isolation only when you have a specific need: security boundaries, resource isolation, or model-level separation that route can't provide. Most teams never need more than 1-2 terminal-isolated workflows.

What's next depends on your goals. Some paths from here: build a customer-facing agent (agents that interact with your clients through your products), create agent-to-agent integrations (one workflow's output triggers another), explore fine-tuning (train specialized models for your most common tasks), or build a monitoring dashboard (real-time visibility into all running agents).

You started this course installing OpenClaw. You're ending it with a production-ready, multi-agent architecture with layered memory, optimized model routing, and automated workflows. The gap between where most people use AI and where you are now is measured in years of competitive advantage. Build things that matter. Ship things that work. Let the agents handle the rest.

Walkthrough

  1. 1
    List all your current workflows: ls projects/
  2. 2
    For each workflow, document: purpose, subagent count, model routing, estimated cost per run, schedule
  3. 3
    Create a cost monitoring system: SQLite table tracking API spend per workflow per day
  4. 4
    Review each workflow: is it delivering enough value to justify its cost?
  5. 5
    Identify your next 3 workflow candidates — what manual processes could you automate?
  6. 6
    For each candidate, sketch the subagent architecture (roles, boundaries, model tiers)
  7. 7
    Set up a weekly review: every Monday, check workflow logs, API costs, and results quality
  8. 8
    Create a system documentation file: memory/knowledge-base/agent-architecture.md with your complete setup

Checkpoint

You have a documented agent architecture with cost monitoring. You've identified your next automation targets. You have a weekly review process for maintaining and scaling your agent infrastructure.