AI with Aish

AI with Aish

Build Your First AI Agent

Without Overengineering It (Using AG2)

Aishwarya Srinivasan's avatar
Aishwarya Srinivasan
Apr 11, 2026
∙ Paid

Welcome to the my blog- and today, let’s talk about practical agent engineering.

I am sure, you have probably seen the shift already. The first wave of agent hype was full of sprawling demos, oversized multi-agent swarms, and systems that looked impressive on stage but became expensive, brittle, and hard to control in production.

What is replacing that approach is not bigger agent stacks. It is leaner architecture, clearer tool use, and tighter operational control.

In this guide, we will focus on how to build an agent that is actually useful in the real world. We will use AG2, the actively developed framework formerly known as AutoGen, and compare how modern frontier models like GPT-5.4 and Claude 4.6 fit into agent design, planning, and execution. We will also look at where protocols such as MCP fit into production-grade workflows.

The goal of this guide is simple: build an agent system that is technically sound, maintainable, and worth running beyond a demo.


Agenda

  1. The Philosophy of Autonomy: Understanding why static chains are being replaced by goal-driven agent loops.

  2. The 2026 Agent Stack: A practical look at AG2 (formerly AutoGen), MCP, and the modern agent tooling ecosystem.

  3. Architecting the Brain: Comparing how GPT-5.4 and Claude 4.6 handle planning, reasoning, and tool use.

  4. The Build (Hands-on): Constructing an HPC-aware SRE agent for real-world distributed systems.

  5. Anti-Patterns & Overengineering: Applying the “Rule of Three” to avoid unnecessary multi-agent complexity.

  6. The Evaluation Engine: Measuring agent performance using reliability, latency, and cost-aware metrics.

  7. LinkStash: A curated set of resources for building production-ready agents in 2026.

AI with Aish is a reader-supported publication. To receive new posts and support my work, consider becoming a free or paid subscriber.


1. The Philosophy of Autonomy: From Chains to Actors

In the early days of LLM development, we built Chains. You’d pipe the output of one prompt into the input of another. It was linear, predictable, and incredibly brittle. If Step 2 failed, the whole chain broke.

That abstraction does not hold up in real-world systems.

Today, we have shifted toward agent loops. Instead of defining a fixed sequence of steps, you define a goal, give the system access to tools, and let it iteratively plan, act, and adapt based on intermediate results.

This shift was initially popularized by the ReAct (Reasoning + Action) pattern. However, modern agent systems go beyond simple ReAct loops. They combine:

  • Structured tool calling instead of free-form text actions

  • Explicit control loops (plan → execute → observe → revise)

  • Stateful execution, where the agent maintains context across steps

  • Optional human-in-the-loop checkpoints for critical decisions

The Modern ReAct Loop

At the core of most agent systems is a simple but powerful pattern: Reasoning → Action → Observation.

The loop starts with a user-defined goal. The agent enters a reasoning step, where it “thinks” about what to do next based on the current context.

From this reasoning step, the agent selects an action. In practice, this means choosing a tool to call, such as querying a database, running a function, or making an API request.

One way to structure these agent loops is through an actor-style architecture, which is used in frameworks like AG2 (formerly AutoGen).

In this paradigm, agents are modeled as independent units of computation that:

  • Maintain their own internal state

  • Communicate via asynchronous message passing

  • Process incoming tasks through a controlled execution loop

This approach is similar to how modern backend systems are designed, where independent services maintain their own state and communicate through well-defined interfaces and events.

It becomes especially useful when you are dealing with long-running workflows, multi-agent coordination, or systems that need to operate asynchronously at scale.

That said, it is important to note that not every agent system needs a full actor-based design. Many production systems work effectively with a single agent and a well-defined control loop.

The key idea is not the actor model itself, but the shift toward systems that are stateful, tool-driven, and capable of adapting their behavior over time.

I am hosting a 6-week Mastering Agentic AI Certification with my co-founder Arvind Narayan, to help you build the skills and system-level understanding needed to become the top 0.1% of AI experts.

  • This is not just for builders or engineers. In today’s AI landscape, being “technical” is no longer optional, even if you are in product, product marketing, GTM, sales, or partnerships. You don’t need to write code every day, but you do need to understand how these systems work.

  • The idea of being a builder has also become far more accessible. With the range of no-code and low-code tools available today, you can build real agentic workflows and automations without being an engineer.

  • To make sure your learning reflects how AI systems are actually built in practice, we have partnered with companies like NVIDIA, Nebius, AG2, LlamaIndex, Pinecone, and others. You’ll get access to free credits and hear directly from industry leaders through guest sessions.

  • We also have a bonus week at the end where we will cover the state of the AI job market, how to upskill effectively, how to build strong technical visibility across platforms like GitHub, LinkedIn, and Substack, and how to become AI-native so you can significantly improve your productivity.

Special 10% discount to my Substack readers with coupon code: SUBSTACK-AISH


2. The 2026 Tech Stack: Deep Diving into v0.4

If you are building agents today, it helps to separate the stack into three different concerns:

  • the agent framework, which handles orchestration and control flow

  • the model layer, which powers reasoning, planning, and tool use

  • the integration layer, which connects the agent to external systems and data

The Layered Architecture

One useful way to understand AG2 is to think of it as a layered system:

  1. Layer 1: The Runtime Layer

    This is the execution backbone. It handles message passing, agent state, and the control loop that drives reasoning → action → observation.

  2. Layer 2: The Agent Layer

    This is where you define agents, their roles, and their interactions.

  • Define agents with specific responsibilities

  • Attach tools and capabilities

  • Structure workflows (single-agent or multi-agent)

  1. Layer 3: The Integration Layer

    This connects your agent to the outside world.

  • Model providers (OpenAI, Anthropic, open-source)

  • Tools and APIs

  • MCP and other external integrations

The key idea is that AG2 separates orchestration, agent behavior, and integrations, which makes systems easier to scale and maintain.

The Model Context Protocol (MCP)

If AG2 handles orchestration, MCP is a clean way to connect agents to external systems.

MCP is an open standard for exposing tools, data sources, and services through a consistent interface. It lets you integrate things like databases, APIs, and internal systems without building one-off connectors each time.

In practice, teams still use a mix of MCP, direct function tools, and internal APIs. The value of MCP is in making integrations more standardized and reusable, not replacing them entirely.

I’m not going to be covering too much about MCP in this particular blog but I would highly recommend you can go check out this resource to learn more.


3. Architecting the Brain: GPT-5.4 vs. Claude 4.6

Choosing your model is one of the most important decisions in agent design. The trade-offs typically come down to planning depth, tool-use reliability, and context handling. These are the top two models in terms of performance so we will primarily be sticking to these two models for the blog:

GPT-5.4:

OpenAI’s GPT-5.4 introduced a native “Thinking” mode. When the model encounters a complex task, it doesn’t just output tokens; it internally simulates multiple paths and only outputs the most successful one. It currently leads the SWE-Bench Pro for terminal-based coding and autonomous debugging.

Claude 4.6 Opus:

Anthropic’s Claude 4.6 Opus offers a 1-million-token context window. For technical agents, this is a game-changer. You can feed the agent your entire system documentation, previous eBPF traces, and the current code repository without needing complex RAG (Retrieval-Augmented Generation) pipelines.


4. The Build: An HPC-Aware SRE Agent

We are building an agent designed to troubleshoot a high-performance computing (HPC) cluster. It needs to:

  1. Check Slurm job queues.

  2. Analyze eBPF metrics for network bottlenecks.

  3. Suggest a remediation plan.

For simplicity, we’ll use the high-level agentchat abstractions (inherited from AutoGen) that AG2 continues to support. This keeps the example easy to follow, while still reflecting real-world usage.

Step 1: The Environment

We’ll use AG2-compatible packages for agent orchestration and model integrations:

pip install -U autogen-agentchat autogen-ext[openai,anthropic]

Step 2: Defining the Model Client

We’ll use GPT-5.4 for its superior tool-handling.

from autogen_ext.models.openai import OpenAIChatCompletionClient

# Initializing the 2026-tier brain
model_client = OpenAIChatCompletionClient(
    model="gpt-5.4-turbo",
    # Using 'thinking' mode for complex SRE tasks
    model_info={"capabilities": {"thinking": True}},
)

Step 3: Atomic Tools

This is where most systems get overengineered. Avoid building large, abstract tools. Instead, define small, focused functions.

async def get_ebpf_telemetry(node_id: str) -> str:
    """Returns network latency and packet drop metrics from eBPF probes."""
    # Logic to fetch from an MCP server or direct shell execution
    return f"Node {node_id}: Latency 120ms, Packet Loss 0.4%."

async def query_slurm_queue() -> list:
    """Returns the current pending jobs in the Slurm workload manager."""
    return [{"job_id": 104, "status": "PENDING", "reason": "Resources"}]

Step 4: The Agent Team

In AG2, agents can be orchestrated in multiple ways. For this example, we’ll use a simple two-agent setup using the high-level agentchat interface.

from autogen_agentchat.agents import AssistantAgent, UserProxyAgent
from autogen_agentchat.teams import RoundRobinGroupChat
from autogen_agentchat.ui import Console

async def build_sre_team():
    # The 'Reasoning' Agent
    analyst = AssistantAgent(
        name="SRE_Expert",
        model_client=model_client,
        tools=[get_ebpf_telemetry, query_slurm_queue],
        system_message="""You are a Senior SRE. 
        Your goal is to identify why jobs are pending in the HPC cluster. 
        Use eBPF data to check for network congestion. 
        Always provide a technical Root Cause Analysis (RCA)."""
    )

    # The 'Human-in-the-Loop' Proxy
    user_proxy = UserProxyAgent(name="Admin")

    # Orchestration
    team = RoundRobinGroupChat([user_proxy, analyst], max_turns=5)
    
    # Execution
    await Console(team.run_stream(task="Diagnose why Job 104 is stuck."))

I’m hosting a 6-week Mastering Agentic AI Certification with my co-founder Arvind Narayan, focused on helping you build real, production-ready agent systems.

This is not a sponsored blog. We are partnering with AG2 in an educational capacity as part of the program to ensure the content reflects how agent systems are actually built in practice.

If you’re interested in going deeper, you can check out the program here:
https://maven.com/aishwarya-srinivasan/mastering-ai-agents?promoCode=SUBSTACK-AISH

» Substack readers get a 10% discount with code: SUBSTACK-AISH


User's avatar

Continue reading this post for free, courtesy of Aishwarya Srinivasan.

Or purchase a paid subscription.
© 2026 Aishwarya Srinivasan · Privacy ∙ Terms ∙ Collection notice
Start your SubstackGet the app
Substack is the home for great culture