State machines for AI agents: when should you use one?
4 signs your AI agent needs explicit states. Model TypeScript transitions, limit tools, and test the flow without treating the model as deterministic.
Accepting new clients
You run the business.
I handle the software.
I'm Samuel Fajreldines, a senior software engineer. Growing U.S. businesses hire my team to become their software department, not a vendor they rehire every quarter. I set the technical direction, my team builds and ships, and I stay accountable for everything that goes out.
4 signs your AI agent needs explicit states. Model TypeScript transitions, limit tools, and test the flow without treating the model as deterministic.
Structure tools, system, and history so multi-step agents get cache hits on each tool step. Measure cached tokens, stop prefix invalidation, and cut input cost.
Cloud Run Jobs can retry each task up to 3 times. Learn to save checkpoints, make output idempotent, and verify reruns before production safely.
Split AI agent tests into 4 layers: pure code, tools, the real model, and review. Use mocks without false confidence, then run a small real-model eval.
Test a TypeScript MCP server with a stdio client, Vitest, and Inspector. Catch broken schemas, missing tools, and errors before CI.