balkhaev.com Blog · AI agents and automations

BlogSeries

The company AI agent

Building an agent that knows a company's data and answers employees within their permissions. From concept to a running service, step by step, with code.

9 of 9 parts out

All parts09 / 09

  1. 01Concept: an agent that knows the company
  2. 02Talking to a model
  3. 03The agent loop and tools
  4. 04MCP: connecting internal systems
  5. 05Company knowledge: searching documents
  6. 06Permissions: SSO, OAuth and an agent acting on behalf of an employee
  7. 07Context and money: caching, compacting history and limits
  8. 08The interface: a web chat and a Slack bot
  9. 09Into production: perimeter, audit and checks

In every company the answers employees need are scattered across the wiki, databases, the issue tracker, the CRM and chat history. In this series we build an agent that searches all of these systems, knows who is asking and shows only what that person is allowed to see.

The series goes from idea to implementation. First we work out what we are building and why it is built this way, then we write it layer by layer: the model, the agent loop, connecting systems over MCP, document search, permissions, the interface and production. Every part ends with code that runs, and the next part builds on it.

The stack has no frameworks: TypeScript, Bun, a commercial model over an API (Claude) and the open MCP protocol.