Service layer for AI agents: decoupling logic from routes
How a service layer in an AI agent codebase decouples business logic from HTTP routes. The pattern, the tests, and the refactor from a fat route.
Loading...
Explore our latest articles and insights about Architecture.
17 posts in total
How a service layer in an AI agent codebase decouples business logic from HTTP routes. The pattern, the tests, and the refactor from a fat route.
How to structure an agentic AI codebase so it survives growth. The 4-layer pattern, the cut lines, and the refactor that keeps a project shippable.
Why linear LangChain chains fall over on real agents and how LangGraph's stateful graphs replace them. The state model, loops, and upgrade path.
How to manage context windows in production AI agents. The 4 strategies that keep long sessions bounded without losing critical context.
How coding agents remember context across sessions. The memory store, the recall pattern, and the 3 kinds of memory every agent should keep.
How to design custom tools for coding agents that are not read, edit, or bash. The naming rules, the schema patterns, and the 3 custom tools that pay off.
Why ripgrep is the right code search tool for coding agents. The speed, the flags, and the wrapper that turns rg into a safe agent tool.
How to design an edit tool a coding agent can use without wrecking files. The string-match rule, the dry-run pattern, and the 50-line safe edit function.
How to structure tool integrations so an agent stays clean as it grows. The registry pattern, schema-first design, and the 80-line dispatcher that scales.
Why every agentic AI container should run as a non-root user. The Dockerfile pattern, the permission gotchas, and the attack it actually prevents.
Why production LangGraph agents need a postgres checkpointer and thread model. How persistence survives restarts, and the trap that loses every chat.
How a coding agent loop actually works. The minimal while loop that turns a chatbot into Claude Code, and the 4 states every agent cycles through.