AI

How AI agents work and how to build one

How an AI agent works: a system prompt, a goal, tools and a loop that thinks, acts and reads results, and how Temporal keeps long-running agents durable.

  • 8 min read
  • 5 questions
  • +35 XP
Transcript

Building an AI agent, explained by cats. Kitty has an LLM. Very smart. Very chatty. But chatting is not the same as doing. An AI agent is when Kitty gives the model a goal, access to tools, and a loop to keep going until the job is done.

To make that work, Kitty needs a few parts working together. First: the system prompt. That is Kitty’s rulebook. Who you are. What tools you can use. When to ask for help. When not to touch the tuna invoice. Next: the user prompt.

That is the goal. Stuff users ask, like “Find me an event.” “Book the flight.” “Create the invoice.” Then: the tools. Browser. Search. APIs. Database. The model is the brain. The tools are the paws. Then comes the loop. Think.

Pick a tool. Use it. Think again. Over and over until the goal is complete But agents are messy. They crash. They retry. They wait for human approval. And LLMs can change their minds anytime. So Kitty uses Temporal. Temporal keeps the agent running.

It remembers state. Resumes after failures. Waits safely. And handles the workflow around the model. Because AI can be unpredictable. But Temporal makes it durable.