Python
37 articles on BlogLLM
- 24-Probe AI Red-Team Tool Achieves 24% Better Results
I've been following the recent hype around deterministic AI red-team tools, and I'm excited to share my take on what they're all about. The concept of deterministic AI red-team…
- Converting a 15-page Paper to Markdown in 30 Lines of Python
I've seen my fair share of LLM-powered document conversion tools, but this recent post on Dev.to caught my eye. Sid Mishra's article, "A 15-page paper converted to Markdown: what…
- How a Browser Agent Sees a Web Page: DOM, AX Tree, Pixels
An agent cannot act on what it cannot see. So the first job of any browser agent is perception: turn a live page into something a model can read in one prompt. This part shows…
- The Browser Use Agent Loop, Step by Step, With Real Logs
A browser agent is a loop. The model looks, writes something, the harness runs it, the model looks again. The details of that loop decide how fast the agent is, how much it costs…
- Browser Use Tools: Give Your Agent Custom Actions
Tools are how a model touches the world. In a browser agent, the tool design decides what the model can do, how much each step costs and how mistakes show up. browser-use is a…
- Running Browser Use in Production, Plus a Capstone Agent
A browser agent on a laptop is a demo. A browser agent in production is a service: it runs headless, many at a time, on untrusted pages, with secrets nearby, and it must return…
- Deep Agents Glossary: Every Term Explained From Zero
Articles about Deep Agents use a lot of words that sound alike: agent, harness, middleware, backend, subagent, sandbox, checkpointer. Each one is a small wall. After three of them…
- Why Simple Agent Loops Fail on Long, Multi-Step Tasks
The simplest agent is a model in a loop. It reads the messages, asks for a tool call, gets the result, and asks again. It stops when it replies with no tool calls. That agent loop…
- Build Your First Deep Agent in Python and See Inside It
Most "first agent" tutorials stop at one call to invoke. You get an answer back, but you cannot see what the agent was given, what the model saw, or where its files went. With…
- Why Agents Lose Track of Long Tasks, and the To-Do Fix
Give an agent a ten-step job and watch the message list. After a few steps it is mostly raw tool output: file contents, search results, error logs. The plan the model had at the…
- How to Give a Deep Agent Custom Tools and MCP Servers
A deep agent with only its built-in tools can plan, read files, write files and spawn subagents. It cannot check a price, open a ticket or query your database. Those jobs need…
- Why a Chatbot Can't Run Errands: The Agent Loop
A model on its own only produces text. To do an errand it has to look things up, act, see what happened, and act again. Something has to run that cycle, decide which functions the…
- How a Personal Agent Remembers You Between Chats
Models do not remember. Each call starts blank. If you told an agent last week that your sister's birthday is in December, that fact is gone unless something wrote it down and…
- Building the Chat App for a Personal Agent
An agent's work does not fit in a text box. A single turn can include a tool call, a screenshot, a card that needs a tap, a background helper that finishes two minutes later, and…
- Loop or graph: which should you build your AI agent on?
You have a task you want an agent to handle. Do you give it tools and let it loop until it is done, or do you draw the steps as a graph and let the model fill in only the parts…
- 98% of Tests Passed. Only 25% of Real Traffic Matched.
Anthropic moved the API behind Claude from Python to Rust. The post went up on November 25. The headline numbers are big. CPU per request fell about 70%. Memory per request fell…
- Giving a Voice Agent Tools with MCP: Per-Business Servers, Confirmations and Fillers
A voice agent that can only talk is a demo. To be useful on a dental clinic's booking line, it has to look up open slots, find a patient's next appointment, and book or cancel…
- Build a Voice Agent with LiveKit Agents in Python: Inference, MCP Tools and Fallbacks
Most voice agent tutorials stop at "it talks back". A real agent needs more: it has to know when the caller finished speaking, call tools, keep going when a model provider has a…
- Call an LLM From Python and See Why the API Forgets
Before an agent can plan, use tools or remember anything, it has to talk to a language model. That part looks trivial: send some text, get some text back. But the shape of that…
- Write an AI Agent Loop in 60 Lines of Python, No Framework
In lesson 1 the model answered from whatever it learned in training. Ask it about the weather in Kyoto next week and it has two choices: guess, or say it does not know. Neither…
- Tool Calling in Python: Describe a Function With JSON Schema, Run It, Send the Result Back
Tool calling (also called function calling) sounds like the model runs functions. It does not. The model writes a structured request that says "call this function with these…
- How to Design Tools an LLM Agent Uses Correctly: Names, Descriptions and Errors
Your tool might be a carefully written function with tests. The model never sees any of that. It sees a name, a description, and a JSON Schema, and from those few lines it must…
- Structured Outputs in Python: Get Valid JSON From an LLM Every Time
Tool calls are one way a model hands structured data to your code. The other is the final answer. Often your agent's answer is not for a person to read but for code to use: a…
- Safe Agent Tools in Python: Allowlists, Human Approval and Prompt Injection
Everything the trip helper has done so far is read only: look up weather, convert money, search hotels. If the model calls the wrong tool, you get a wrong answer and nothing else…
- Agent Short-Term Memory in Python: Trim and Summarize Chat History
Lesson 1 showed that the API forgets, so your code keeps the conversation in a list and sends all of it on every call. That works for a few turns. But every user message, every…
- Long-Term Agent Memory in Python With Embeddings and NumPy
Lesson 7 kept one conversation inside the context window. But when that conversation ends, the history list is gone. Next week the traveller opens a new chat and the trip helper…
- Agentic RAG in Python: Make Retrieval a Tool the Agent Decides to Call
The trip helper's model knows nothing about Casa Azul's breakfast hours or the price of a day pass in the travel guide. That information lives in a document. If the agent answers…
- ReAct vs Plan-and-Execute Agents, With Python Code for Both
Ask the trip helper "I have 300 USD. Find a Lisbon hotel under 100 EUR a night and tell me if I need an umbrella there." That is three lookups: a currency conversion, a hotel…
- Stop Runaway AI Agents: Step Limits, Retries and Cost Budgets in Python
A chatbot makes one model call per message. An agent makes as many as it decides it needs. Most of the time that is two or three. But nothing in the loop itself prevents twenty…
- Multi-Agent Systems in Python: Orchestrator, Workers, and When One Agent Is Better
As an agent grows, its tool list grows. The trip helper started with one tool; a real one might have weather, currency, hotels, flights, restaurants, visas and bookings. Every…
- Connect a Python Agent to MCP Servers With the Official MCP SDK
So far the trip helper's tools live in triptools.py, inside the agent's own code. That is fine for one agent. But imagine you build three agents that all need the weather tool…
- Test Your AI Agent in Python: A Small Eval Harness With Tool-Call Checks
Every lesson so far changed something: a system prompt, a tool description, a threshold, a model. Each change can fix one behaviour and quietly break another. In lesson 9, a…
- Trace and Debug an AI Agent in Python: Step Logs, Token Costs and Replays
An agent run is a chain of decisions: a model call, a tool call, another model call. When the final answer is wrong, the cause can be at any link. Did the model call the wrong…
- Slow Chatbots: A 30% Bottleneck
I've had my fair share of frustrating interactions with slow chatbots, and I'm sure I'm not alone in this experience. But what's behind this slow performance? Is it the chatbot…
- LLM Sleep Mode: The Hidden Cost of Shared GPU Resources
I've been working with large language models (LLMs) for a while now, and one thing that's become increasingly important is optimizing resource allocation when running multiple…
- Claude Usage Logger in Python: A Step-by-Step Guide
I recently came across the Dev.to article "Anthropic Cost Tracking: Build a Claude Usage Logger in Python" and was impressed by the simplicity and effectiveness of the solution…
- What is an AI agent, really? (A chatbot that can act and check its own work)
An AI agent is a program that takes a goal, makes a plan, uses tools, actions like searching the web or reading a file that the program can carry out for the model, to act on that…