Michał Michalczuk

Your AI Agent is just a while loop with an API call. Let me prove it

Did you know one follow-up question can cost your AI agent over 100,000 tokens? Learn the real engineering challenges behind the hype.

Your AI Agent is just a while loop with an API call. Let me prove it
#1about 4 minutes

The promise and problems of building AI agents

AI agents are easy to create with modern SDKs but present challenges like high costs, rate limiting, and security concerns.

#2about 4 minutes

Creating a simple LLM chatbot in Node.js

A basic chatbot can be built from scratch using Node.js to read user input and make plain fetch calls to an LLM API like Mistral.

#3about 4 minutes

Giving an AI agent powerful shell access

Enhance an agent's capabilities by defining a tool for shell access, sending its definition in the API payload, and executing commands locally.

#4about 5 minutes

Securing agent execution with Docker sandboxes

Mitigate the risks of unrestricted shell access by running the agent's code execution within an isolated Docker sandbox environment.

#5about 7 minutes

Letting an agent add its own memory tool

An agent can be prompted to modify its own source code to add new tools, such as a memory function that saves information to a file.

#6about 5 minutes

Building a multi-agent system through delegation

Structure complex tasks by creating a main agent that delegates specific jobs, like coding, to specialized sub-agents via a tool call.

#7about 5 minutes

The core architecture of an AI agent is a model plus a harness

An AI agent's fundamental architecture consists of a model for reasoning and a harness, which is the environment and tools it uses for execution.

#8about 4 minutes

Understanding the hidden costs of LLM token consumption

Because LLMs are stateless, every API call must resend the entire conversation history, causing input token costs to grow cumulatively.

#9about 7 minutes

How conversation history inflates token costs

A live demonstration shows how adding large tool outputs like file lists to the conversation history makes subsequent simple requests extremely expensive.

#10about 9 minutes

Analyzing token usage in a data-intensive agent

A real-world agent that processes emails and calendar events shows how a single user prompt can trigger multiple tool calls, resulting in over 100,000 input tokens.

#11about 3 minutes

Key takeaways for building effective AI agents

Remember that LLMs are stateless, tool execution is local, and an agent is fundamentally a model combined with a harness of tools and an environment.

Related jobs
Jobs that call for the skills explored in this talk.

Featured Partners

Related Articles

View all articles

From learning to earning

Jobs that call for the skills explored in this talk.