The agentic harness coordinates tool usage by interpreting model requests and executing standard Python functions on its behalf. Because the underlying Chat Completions API is stateless, the custom wrapper must resend the entire conversation history with every subsequent interaction. This iterative loop allows the model to process ongoing tool results to chain tasks together until it reaches a final answer. Setting up this custom environment requires Python 3.15, the uv package manager, and a funded OpenAI API key.
Key points
Standalone language models achieve agency only when an external harness bridges them with…: Standalone language models achieve agency only when an external harness bridges them with actionable tools and user inputs.
Chaining multiple tool calls in an iterative loop enables models to resolve complex tasks…: Chaining multiple tool calls in an iterative loop enables models to resolve complex tasks using sequential operational outputs.
Basic Python proficiencies, such as manipulating dictionaries and handling paths with pat…: Basic Python proficiencies, such as manipulating dictionaries and handling paths with pathlib, are sufficient to implement this architecture.
Sources checked by our analysis pipeline: 1
You know how LLMs work, and you may already use AI agents to help you write code. However, an LLM isn’t an agent. What sits between them is the agentic loop. In this tutorial, you’ll build an AI agent from scratch in Python by writing the harness that turns a language model into an agent. You’ll do this in about ninety lines of code, with no frameworks.
By the end of this tutorial, you’ll understand that:
- An AI agent is a language model wrapped in a harness, which is a loop that passes information between you, the model, and a set of tools.
- The Chat Completions API doesn’t remember earlier messages between calls, so the harness resends the whole conversation context with every request.
- A tool is any action the harness can perform for the model, such as running a Python function. The model learns about the tool only through its description, which includes a JSON schema for its arguments.
- The model never runs a tool itself. It returns a tool call, and the harness decides…
The privacy authority AP conducted an investigation into six different hardware models ranging from under €100 to over €500, discovering critical safety and cybersecurity defects across the products. Testers documented dangerous misinformation during health scenarios, alongside privacy vulnerabilities that permit unauthorized camera access and undetected recording. These failures pose acute hazards for vulnerable groups, including visually impaired individuals who may depend on the technology to navigate their sur…
Strong investor demand is propelling the artificial intelligence company toward a $1.9 trillion valuation, defying an ongoing selloff across the wider technology sector. Backed by substantial compute alliances with prominent cloud providers, the firm secured high-profile coverage from major brokerages anticipating explosive long-term revenue growth.
Defensive cybersecurity efforts are facing critical friction when commercial artificial intelligence guardrails prevent legitimate developers from testing and patching their own systems. Anthropic's restrictions forced an engineer to navigate burdensome exemption processes that mandate identity disclosure and surrender intellectual property safeguards. Consequently, defenders are actively abandoning restricted proprietary platforms for open-weights alternatives to complete routine vulnerability remediation.