AI Agents aren't magic A developer demystifies AI agents by explaining they are not magic but rather LLMs combined with orchestration, context, and tools. They built a simple AI agent in TypeScript and Node.js, available on GitHub, to illustrate the core loop of tool calling and execution. Today, I think all areas, especially IT, are becoming involved with AI. Right now, I think the term I hear most often is AI Agent. For non-technical people, it may seem like it's just the .md files we generate with Claude Code CLI, Codex, and similar tools. But as a engenier or dev, I think it's worth looking a little deeper into what an AI agent actually is. We know it isn't magic. An AI agent is essentially a LLM combined with orchestration, context, and tools that let it perform actions beyond generating text. To summarize the "magic" behind tools like Claude Code, you can think of them as a loop. As programmers, imagine something like: js while true { const response = llm messages if response.toolCall { result = executeTool messages.push result continue } return response } After that, behind the scenes, we add context and provide the model with information about the available tools. I emphasize the tools because an LLM can't do anything other than generate text tokens . We give it capabilities through predefined "contracts." Conceptually, it's like telling the model: { "action": "tool call", "tool": "tool name", "args": {} } If the model responds using the expected structure, our loop invokes the corresponding tool. The function execution is what actually performs the action the model selected to answer your request. Modern APIs usually expose native tool calling, but conceptually this is what's happening under the hood. Of course, modern agents involve much more than this. They also include context management, memory, execution limits, retries, guardrails, planning, and support for multiple tool calls. I'm simplifying the architecture to focus on the core idea. This can sound quite abstract, so I built a small AI agent using TypeScript and Node.js. The repository is here: https://github.com/patrick0806/Simple-Agent https://github.com/patrick0806/Simple-Agent It has three main files: tools.ts: Contains the tools. Their implementations give the agent the ability to interact with the real world. guardrails.ts: Contains the safeguards. Here we define prompts and validation logic. index.ts: Contains the main agent loop, where I connect to Ollama, receive user prompts, invoke tools, and orchestrate the entire workflow. This is just a showcase project with simple implementation its not for work or anything like that, its more to see the raw implementation about how a Agent is started to build and how this works