Urgent.News

What's breaking now, across thousands of outlets.

AI

From Software Engineer to AI Engineer - Part 6: Closing the loop

Everything so far has been single-shot. One call in, one result out, with us gluing the pieces together. But what if we get a realistically complex prompt: "Tell me how much it costs to refund 100 euros to a European consumer card. Then issue a full refund of 100 euros for payment with id abc123 and write a confirmation email to the customer." Answering that means searching the knowledge base for…

In the final part of the series, the author explains the concept of agent loops and how they enable AI systems to adapt dynamically to varying user prompts and retrieval results. Unlike single-shot systems that follow a fixed sequence of tool calls, agent loops allow the system to reason about what actions to take next based on the conversation history, tool catalog, and system prompt.

The author introduces the ReAct pattern, where the model alternates between reasoning about the next action and invoking tools to execute that action. This is similar to the logic seen in previous parts of the series, where the model reads the conversation context, determines if it needs to call a tool, and then executes the tool-call response.

The author emphasizes that the harness of an AI system, which includes the system prompt, tool catalog, middleware, and the agent loop itself, is the responsibility of an AI engineer to design. The author compares the model to Tony Stark and the harness to Iron Man's suit, highlighting the importance of the harness in shaping the behavior of the AI system.

Next, the author demonstrates how to build a simple agent using LangChain's `create_agent` function, which automatically handles the loop of reasoning and acting based on the provided tools and system prompt. The author provides an example `agent_0.py` script that creates a simple payment refund assistant using LangChain tools and the ReAct pattern.

The key points of the article are:

1. Agent loops allow AI systems to dynamically adapt their behavior based on the conversation context and tool results.

2. The ReAct pattern enables the model to reason about the next action and then execute that action through tool calls.

3. The harness of an AI system includes the system prompt, tool catalog, middleware, and agent loop, and it is the responsibility of the AI engineer to design this harness.

4. LangChain's `create_agent` function abstracts away the loop logic, allowing developers to focus on defining the system prompt, tools, and the model to use.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in AI

Anthropic's Claude is Coming to CarPlay

Anthropic could soon add CarPlay integration to the Claude iOS app, based on code found in the latest Claude app update. With ‌CarPlay‌ support, Claude users will be able to talk to Claude…

OpenAI GPT-6 Astra Cyber Risk Analysis

OpenAI launched GPT-6 Astra, its new flagship large language model, which has reached the “Critical” cybersecurity risk level under the company’s Preparedness Framework.

More from Friday 4 September →