<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[data from the trenches - Medium]]></title>
        <description><![CDATA[tech articles by the engineers and AI experts @ dataiku - Medium]]></description>
        <link>https://medium.com/data-from-the-trenches?source=rss----853867ec3a23---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>data from the trenches - Medium</title>
            <link>https://medium.com/data-from-the-trenches?source=rss----853867ec3a23---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 15 Nov 2026 09:56:28 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/data-from-the-trenches" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Agent evaluation: What to measure, how, and when]]></title>
            <link>https://medium.com/data-from-the-trenches/agent-evaluation-what-to-measure-how-and-when-3c1ef6a9f19e?source=rss----853867ec3a23---4</link>
            <guid isPermaLink="false">https://medium.com/p/3c1ef6a9f19e</guid>
            <category><![CDATA[ai-agent-evaluation]]></category>
            <category><![CDATA[agent-evaluation]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[llm]]></category>
            <dc:creator><![CDATA[Adel Hassen]]></dc:creator>
            <pubDate>Thu, 22 Oct 2026 17:12:07 GMT</pubDate>
            <atom:updated>2026-10-22T17:12:06.652Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mmRasumk0As5fLoVV27k5Q.jpeg" /></figure><p>Today, LLM agents are everywhere and they are fundamentally changing the way we work. They are revolutionizing automation, decision support, and enterprise workflows. Companies are integrating agents into their ecosystems while more platforms are offering agents as a core offering. The buzz is warranted; agents bring a level of power that attracts tech and non-tech crowds alike. Building an agent and observing its capabilities creates excitement. You can see the agent take instructions, interact with its environment, and take actions to achieve goals. That’s great. But how do we know if the agent is doing a good job? Let’s say we make changes to our agent; do we know the effect of those changes? This is where evaluations come into play.</p><p>Evaluations exist throughout the entire agent development lifecycle. We focus on testing and validation during the development phase, then shift our attention to monitoring once the agent is in production. 2025 was dubbed the year of agent POCs. Now, companies are ready to take agents into production. <strong>Evaluation will allow teams to ship agents with confidence and build trust</strong>.</p><h3>Understanding agent evaluation</h3><h4>What are agents?</h4><p>Before diving into how to evaluate an agent, let’s define it.</p><p>Agents are <strong>autonomous systems</strong> generally powered by a large language model (LLM) and capable of taking actions required to achieve objectives across multiple steps. Unlike traditional software that generally maps inputs to outputs, agents have the liberty of reasoning and deciding what action to take. Powerful but more difficult to control.</p><p>An agent is generally made up of three key components:</p><ul><li><strong>Reasoning engine:</strong> typically an LLM that analyzes information and makes decisions on what actions to take.</li><li><strong>Tools:</strong> external capabilities the agent can invoke like an API call or web search. The sequence of actions and tool calls is known as a trajectory and is a major focus of agent evaluations.</li><li><strong>Memory:</strong> how the agent stores and retrieves context such as conversation history and user preferences.</li></ul><h4>What is agent evaluation?</h4><p>Agent evaluation is a <strong>structured process of measuring an agent’s behavior</strong>. We assess how well the AI system can autonomously perform tasks, leverage tools to take actions, and reason over multiple steps to achieve an objective.</p><p>For practitioners experienced with evaluating traditional machine learning systems, agent evaluation introduces a more comprehensive set of evaluations. Traditional ML evaluations focus primarily on a model’s performance on a fixed dataset; agent evaluations require us to assess an autonomous AI system that can reason, call tools, and has multiple ways of achieving its objectives.</p><p>We know agents pack power with a hint of unpredictability. With an agent, we aren’t working with a simple input/output combination; they operate over multiple turns. This makes agents useful, but it also makes them <strong>difficult to evaluate</strong>.</p><p>In traditional software development, unit and integration tests help ensure code correctness, reliability, and stability by catching bugs before they reach production. Agents introduce variability in their outputs that renders standard software testing inadequate. Holding everything constant and asking the same question twice doesn’t guarantee the same result, let alone the steps required to get to the result. Using evaluations is a good mechanism to measure and limit this variability.</p><p>Another challenge is silent failures and error propagation. Agents can fail a step, continue to run steps, and return a faulty result with complete confidence. This means some errors won’t even return an error message!</p><p><strong>Agent evaluation isn’t a one-off activity, it actually spans the entire project lifecycle</strong>. During the development phase, we will validate and test whether our agent behaves correctly by grading it on a diverse set of examples where the expected outcome is known. In production, we will monitor our agent to ensure things are running smoothly and performing well when handling real-world requests.</p><h3>What do we measure?</h3><p>It’s time to figure out what we want to measure. Agent performance can’t be captured in a single score so we need to measure different aspects of an agent’s performance. We define two performance areas: <strong>Operational</strong> and <strong>Behavioral</strong>. Each performance area comes with its own set of evaluation dimensions and corresponding metrics.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6YRRGyb6E2anJmAv.png" /></figure><h4>Operational performance</h4><p>Operational performance measures whether the agent executes tasks reliably and efficiently.</p><p>Key evaluation dimensions</p><ul><li>Latency</li><li>Resource usage</li><li>Cost efficiency</li><li>Reliability</li></ul><p>Example metrics</p><ul><li><strong>Response latency:</strong> time taken to complete actions and produce the final output.</li><li><strong>Memory and processing usage:</strong> CPU, GPU, and memory consumed during task execution.</li><li><strong>Token consumption: </strong>the number of input and output tokens used by an LLM-based system, which helps estimate system costs.</li><li><strong>Tool call failure rate:</strong> ratio of failed tool calls to total tool calls.</li></ul><p>These metrics don’t require comparing the agent’s performance to a reference; they capture how the system performs.</p><h4>Behavioral performance</h4><p>Behavioral performance measures whether the agent behaved correctly while completing a task. We evaluate both the final response and the trajectory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*RvbLhqJyWT8tQHG4.png" /></figure><p>While we are building the agent, we can establish ground truth, which consists of the expected outcome and, when relevant, the expected behavior or trajectory. We then compare the agent’s actual behavior against the ground truth. The appropriate metric depends on the task. High-stakes workflows may require an exact trajectory match, while more flexible tasks may only require certain tools to appear in the correct order.</p><p>Key evaluation dimensions</p><ul><li>Tool-use correctness</li><li>Trajectory correctness</li><li>Output correctness</li></ul><p>Example metrics</p><ul><li><strong>Single-tool use: </strong>verifies that a mandatory tool call was used.</li><li><strong>Exact/strict match trajectory:</strong> requires the actual actions to match the expected actions and be in the expected order.</li><li><strong>Precision of trajectory: </strong>measures how many actions taken were correct according to the expected trajectory.</li><li><strong>Semantic match: </strong>measures whether the agent’s final response conveys the same meaning as the expected response.</li></ul><h3>How do we measure it?</h3><p>Once you know what to measure, we can choose how to measure it. A robust evaluation strategy combines <strong>deterministic checks, LLM judges, and human judgment.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*z4ejVo2s98Wor7Jx.png" /></figure><p><strong>Deterministic evaluations should be our first choice</strong> when success can be expressed objectively. We can execute these checks using code. They can verify the metrics we defined above such as single-tool use, trajectory match, and token consumption.</p><p>They can answer questions such as:</p><ul><li>Did the agent produce valid JSON?</li><li>Did it call the correct tool with the correct arguments?</li><li>Did it stay under the token budget?</li><li>Did the workflow complete within the latency SLA?</li></ul><p>These evaluations are fast, cheap, and reliable. When success relies on subjective qualities, this is when the limitations of deterministic evaluations kick in.</p><p><strong>LLM judges or LLM-as-a-judge come into play when our checks aren’t deterministic</strong>. Instead of defining rigid rules, we use one LLM to evaluate the output of another LLM/agent. LLM judges can evaluate an agent based on a rubric or trait for things like helpfulness, tone, or relevance. LLM judges provide the benefit of evaluating subjective qualities and scaling better than human evaluations, but they come with their own set of complications. They rely on an LLM, which incurs a cost each time the metric runs, and their reliability depends on the quality of the evaluation criteria. For subjective or domain-specific traits, calibration against human judgment can help ensure the LLM judge differentiates good and bad output.</p><p>These are questions LLM judges would be perfect for answering:</p><ul><li>Was the response helpful?</li><li>Was the explanation complete?</li><li>Was the tone appropriate?</li><li>Was the reasoning sound?</li><li>Did the agent choose a reasonable strategy?</li></ul><p><strong>Human judgment remains the gold standard for evaluating agent performance</strong>. Humans act as the calibration layer for the entire evaluation pipeline. It is the responsibility of a human to define what a good output looks like and why it is a good output. When starting the agent evaluation process, a Subject Matter Expert (SME) is responsible for labeling responses in an evaluation dataset and writing an explanation. This is what we will eventually calibrate LLM judges against.</p><p>Each of these strategies answers a different question. Humans define ground truth and periodically validate evaluations. Deterministic evaluations provide fast, cheap, and reliable checks. LLM judges expand our evaluation capabilities by checking subjective and complex behaviors.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*tTFPzCg5xI3B8P4S.png" /></figure><h3>Evaluating agents across the lifecycle</h3><p>We know what to measure and how to measure it; now, let’s figure out when to apply evaluations. There are two distinct phases of agent evaluation: pre-deployment validation and post-deployment monitoring. The data we have available, the goals, and the techniques we use across the two phases differ. Let’s look deeper into what makes these two phases different.</p><h4>Pre-deployment validation</h4><p>The primary objective before deploying an agent is to ensure it meets the quality requirements for real-world use.</p><p>This is our opportunity to run validation and testing in a controlled environment. We determine what tasks an agent can do, create a set of representative test cases with expected outcomes, and define what good behavior looks like. This makes the pre-deployment phase perfect for validating both what the agent produces and how it gets to those outcomes. We can also establish performance baselines, uncover failure modes, and iterate on the agent to prevent known failures from reaching users.</p><p>At the center of validation is what is known as the <strong>evaluation dataset </strong>or <strong>golden dataset</strong>. It contains representative examples of tasks we expect the agent to handle along with the expected outcomes and behaviors required to evaluate them. Building a good evaluation dataset often requires SMEs to provide their domain knowledge to properly define correct responses and behaviors. In the case of an HR agent, an HR expert will know whether an answer actually provides the level of explanation required to handle an employee’s question or if an HR request needs to be routed through a particular system.</p><p>Once we have an evaluation dataset, we can run the agent against those test cases and measure its performance.</p><p>During pre-deployment, behavioral evaluation is particularly important because we can compare the agent’s performance to expected outcomes and behaviors. As mentioned earlier, we evaluate the final response and trajectory using a combination of deterministic checks, LLM judges, and human review. For operational evaluation, we can establish performance thresholds around latency, resource usage, and token consumption we expect the production-ready agent to meet.</p><p>Putting it all together, we create a validation loop:</p><ol><li><strong>Build a representative evaluation dataset:</strong> include common tasks, edge cases, and important workflows.</li><li><strong>Define expected outcomes and behaviors:</strong> specify the agent’s desired final response and how it should behave.</li><li><strong>Run the agent multiple times:</strong> since agents are nondeterministic, measure variance in responses and identify inconsistent behavior.</li><li><strong>Apply multiple evaluation methods:</strong> combine deterministic checks, LLM judge traits, and human review.</li><li><strong>Analyze failures:</strong> inspect final response, individual tool calls, trajectory, and other relevant metadata to diagnose failures.</li><li><strong>Iterate and rerun:</strong> fix failures, update the evaluation dataset, and compare the new version against the previous baseline.</li></ol><p>There will always be room for improvement, but that shouldn’t hold us back from deploying the agent. The objective of the pre-deployment phase is to understand how the agent behaves, where it fails, and whether the agent’s performance shows it’s ready for production.</p><h4>Example: Evaluating an HR agent</h4><p>Let’s use an HR (Human Resources) agent to walk through the entire agent evaluation lifecycle. The goal of the HR agent is to help employees answer HR questions and automate basic HR workflows.</p><p>The agent has access to several tools that allow it to accomplish HR tasks:</p><ul><li>Company policy retrieval to find relevant HR policies</li><li>PTO (Paid Time Off) balance API to retrieve an employee’s available PTO balance</li><li>Payroll system to answer pay-related questions</li><li>HR ticket system access to look up, submit, and route HR requests</li><li>Employee directory lookup to identify the appropriate contact</li></ul><p>Let’s see how the HR agent is validated before deployment and monitored after deployment.</p><p><strong>Step 1: Build the evaluation dataset</strong></p><p>The first step is to work with HR SMEs to create a representative set of test cases that cover edge cases and important workflows. The dataset could be as simple as this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qLQ6-fACKaQCD6X7.png" /></figure><p>These examples define the answer we want to see and how the agent should get to that answer.</p><p><strong>Step 2: Validate answers and behaviors</strong></p><p>Next, we run the HR agent against the evaluation dataset and examine three things:</p><ul><li>What the agent answered with</li><li>What the agent did</li><li>How the system performed</li></ul><p>For the PTO days test case, the final answer might be correct, but the actual trajectory could reveal that the agent never called the PTO API. A single-tool-use check could verify that a mandatory tool was used. For a parental-leave question that requires escalation to an HR specialist, the agent must first search the employee directory to identify the appropriate contact, then retrieve the contact’s details. This is perfect for an exact trajectory match since we require the actual trajectory to match the actions and order of the expected trajectory.</p><p>Operational metrics can reveal if the agent consistently takes too long to answer or if it consumes more tokens than we allow it to.</p><p>It’s also important to run the agent multiple times to identify any sort of inconsistent behavior across runs.</p><p>There is no single score that can represent agent performance. We must strategically choose metrics to evaluate different dimensions. This is why pre-deployment validation should combine:</p><p>Final response quality + tool use and trajectory + operational performance</p><p><strong>Step 3: Use LLM judges and human judgment</strong></p><p>Some HR interactions require more nuance than others. Determining if the PTO balance tool was called can be handled by a deterministic check. Determining if an explanation of a benefits policy is clear and helpful? That’s much harder to answer with deterministic checks. This is where an LLM judge can evaluate a defined trait or rubric. An LLM judge can answer questions like:</p><ul><li>Is the response consistent with the provided policy?</li><li>Does the response provide enough context for the employee to understand what to do next?</li><li>Does the response directly answer the employee’s question?</li><li>Is the agent’s final outcome the same as the expected final outcome?</li></ul><p>All four of these questions are individual traits. Each one has a prompt that specifies the criteria for the check. For example, the criteria for the final outcome check might direct the LLM judge to check if the agent’s answer and the reference answer are semantically equivalent with no contradictions.</p><p>SMEs should also review traits for the test cases in the evaluation dataset to validate whether the LLM judge aligns with their expert judgment. Disagreements between the SME and LLM judge help highlight weaknesses in the agent but also potential ambiguity in the evaluation criteria itself. The goal is to ultimately have your test cases pass both SME and LLM judge evaluation.</p><h4>Post-deployment monitoring</h4><p>Now that the agent is deployed, our evaluation focus changes.</p><p>In development, we operate in a controlled environment where we decide the test cases and define the ground truth. In production, we face unexpected requests, changing business processes, and model updates.</p><p>This is why we can’t treat production monitoring as pre-deployment validation at a larger scale. They have two completely different objectives.</p><p>The goal of the post-deployment phase is to determine whether the deployed agent remains <strong>healthy and behaves</strong> correctly when tasked with real-world requests. We need to detect operational issues, performance degradation, unexpected behaviors, and new failure modes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*lJXrU58lu4F4igON.png" /></figure><p>A key part of monitoring is capturing the <strong>agent’s traces</strong>. A trace is a raw record of what happened during a run. It includes the user’s request, actions taken by the agent, the tools called, intermediate results, guardrails triggered, timespans, the final output, and other metadata. The final output isn’t enough; we need a detailed log of every decision and action the agent took to confirm the agent produced the correct answer without triggering guardrails, making excessive tool calls, or burning unnecessary tokens.</p><p>Operational monitoring provides the baseline. Evaluation dimensions like latency, resource consumption, token consumption, and tool-call failures allow us to establish alerts, catch cost or latency increases, and identify infrastructure problems.</p><p>Behavioral monitoring also has its role in the post-deployment phase. In production, we generally don’t have a defined reference answer or expected behavior. Instead, we extract the actual response and trajectory from the agent trace and use different evaluation methods to understand what’s going on. Deterministic checks can monitor objective characteristics. LLM judges can check for relevance, helpfulness, and other subjective traits. Even human feedback can be incorporated into the mix through thumbs up/down, escalations, support tickets, and periodic SME reviews.</p><h4>Example: Evaluating an HR agent continued</h4><p><strong>Step 4: Monitor the agent in production</strong></p><p>Once the agent meets the required validation criteria, we can deploy it into production with monitoring in place.</p><p>Monitoring our agent starts with capturing traces. We can then decompose the trace to inspect the agent’s behavior. For each interaction, we capture a trace that contains information like tool calls, final responses, technical metadata, and more. We start with tracking operational dimensions like latency, token consumption, tool failures, and resource usage to monitor the health of our system. We can also use behavioral evaluations to observe what is happening and identify interactions that require further inspection.</p><p><strong>Step 5: Turn production failures into new test cases</strong></p><p>Let’s say an employee tells the HR agent, “I need to change my direct deposit.” The agent then incorrectly attempts to modify the employee’s bank details instead of routing the employee to the Payroll workflow as expected.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*D0ikRXUhZNywIgSD.png" /></figure><p>How do we know this happened? From the agent’s trace, we know there is an unexpected tool call. An LLM judge could be used to assess improper behavior. A user could have submitted a thumbs down because the agent made a mistake with the bank details.</p><p>Once an interaction is flagged, an SME can review it to confirm that it is a genuine failure. They can confirm the root cause and we can turn the interaction into a new test case in our evaluation dataset with expected outcome and behavior documented. We could even add a guardrail that prevents the agent from performing similar actions again.</p><p>The next version of the agent can be tested against the updated evaluation dataset before the next deployment. This creates the evaluation flywheel:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*PWWsyQpvpOaWA9tG.png" /></figure><p>The agent evaluation strategy <strong>evolves as the agent encounters more real-life interactions</strong>. Production failures become new evaluation cases which make the evaluation dataset more comprehensive and help future versions of the agent improve.</p><h3>Conclusion</h3><p>Agents are powerful systems that can reason, take action, and autonomously achieve goals. That same autonomy makes agents harder to trust. Evaluations give us a way to comprehensively assess the agent’s responses and behaviors.</p><p><strong>A single score isn’t an agent evaluation</strong>. We need a comprehensive strategy to evaluate what the agent produces, how it gets there, and how reliably the system operates using a combination of methods like deterministic checks, LLM judges, and human feedback. Before deployment, we validate the agent’s performance against a representative evaluation dataset composed of test cases with known answers and behaviors. After deployment, we monitor real-world interactions, find new failure modes, and feed those back into the evaluation dataset for future validation.</p><p>Ultimately, <strong>evaluation is what separates an impressive demo from a reliable agentic system</strong>. As agents move into more critical and complex workflows, a strong evaluation strategy will be key to building systems you can confidently deploy, continuously improve, and users can trust.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3c1ef6a9f19e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-from-the-trenches/agent-evaluation-what-to-measure-how-and-when-3c1ef6a9f19e">Agent evaluation: What to measure, how, and when</a> was originally published in <a href="https://medium.com/data-from-the-trenches">data from the trenches</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a LangGraph Agent in Dataiku]]></title>
            <link>https://medium.com/data-from-the-trenches/building-a-langgraph-agent-in-dataiku-2f3d91f6ef8b?source=rss----853867ec3a23---4</link>
            <guid isPermaLink="false">https://medium.com/p/2f3d91f6ef8b</guid>
            <dc:creator><![CDATA[Remi Rosenthal]]></dc:creator>
            <pubDate>Fri, 14 Aug 2026 07:34:11 GMT</pubDate>
            <atom:updated>2026-08-14T07:34:09.640Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="row of surfboards" src="https://cdn-images-1.medium.com/max/1024/1*zkGooEdTZoz7S_zcKU3pOA.jpeg" /><figcaption>Image from <a href="https://unsplash.com/fr/photos/cintres-en-bois-marron-sur-plantes-vertes-FFCgotROOTY">Unsplash</a> made by <a href="https://unsplash.com/fr/@tatonomusic">Tatanomusic</a></figcaption></figure><h3>Background on the Surf Trip Planner Agent</h3><p>The project was born out of a personal pain point: the need to streamline remote work logistics — specifically, coordinating surfing trips to southwest France. Traditionally, this requires a recurring manual workflow whenever favorable conditions align:</p><ul><li><strong>Environmental Monitoring:</strong> Analyzing surf forecasts and wave conditions, primarily for upcoming weekends.</li><li><strong>Schedule Synchronization:</strong> Reviewing professional calendars to identify mandatory in-person meetings or events in Paris.</li><li><strong>Travel Procurement:</strong> Searching for available round-trip train tickets and managing booking logistics.</li></ul><p>The goal of this project was to determine how an agentic system could automate these low-value administrative tasks, allowing for more efficient decision-making and eliminating manual oversight.</p><figure><img alt="current surf conditions visual" src="https://cdn-images-1.medium.com/max/898/1*-qC_GX0h3RJ_UoPE5SRV5g.png" /><figcaption>Forecast sample from <a href="https://www.surfline.com/surf-report/biarritz/5842041f4e65fad6a7708bca">Surfline</a></figcaption></figure><h4>The advantages of code-based agents</h4><p>Developing the surf trip planner required a well-defined workflow, including specific data requirements, clear decision-making logic, and procedural milestones.</p><p>Code-based agents in Dataiku offer the flexibility of custom development alongside seamless platform integration. This ensures that custom agents can leverage the full suite of features available in Dataiku, operating with the same compatibility as native visual agents.</p><p>Specifically, code-based agents provide:</p><ul><li><strong>Graph Customization:</strong> The ability to design tailored logic graphs by blending standard workflows with ReAct loops.</li><li><strong>Context Management:</strong> High-precision control over the information and state provided to the agent.</li><li><strong>Operational Granularity:</strong> Fine-tuned oversight of the agent’s execution and reasoning processes.</li></ul><p><strong>Note:</strong> With the introduction of <a href="https://doc.dataiku.com/dss/latest/agents/structured-visual-agents/index.html#structured-visual-agents">structured agents</a>, users can now build sophisticated workflows using a no-code visual interface, offering an alternative for complex agent design.</p><h4>Framework selection</h4><p>The agent was developed using <a href="https://www.langchain.com/"><strong>LangChain</strong> and <strong>LangGraph</strong></a>, both of which are industry-standard libraries for building agentic workflows. These frameworks offer seamless integration with Dataiku, providing a robust foundation for development.</p><p>A significant advantage of this stack within the Dataiku ecosystem is the ease of observability. For instance, the <a href="https://doc.dataiku.com/dss/latest/agents/tracing.html#using-the-trace-explorer"><strong>Traces Explorer</strong></a> web app — a dedicated tool for trace analysis — can be activated with a single line of code.</p><p>While <a href="https://developer.dataiku.com/latest/tutorials/genai/agents-and-tools/integrating-agent-framework/index.html#integrating-an-agent-framework">alternative frameworks</a> such as <strong>CrewAI</strong> or <strong>LlamaIndex</strong> remain viable options, the LangChain ecosystem was selected for its versatility and the efficiency it offers when operating within Dataiku.</p><h4>Requirements</h4><p>The agent’s primary objective is to coordinate round-trip logistics for a surfing excursion. To ensure successful execution, the system must perform a comprehensive assessment of two critical variables:</p><ul><li><strong>Environmental Validation:</strong> The agent must verify that forecasted wave conditions align with predefined quality criteria.</li><li><strong>Operational Feasibility:</strong> The itinerary must be cross-referenced with the user’s schedule to ensure the trip is compatible with existing professional and personal commitments.</li></ul><p><strong>User Scenario</strong></p><p>The agent’s workflow is designed to automate the decision-making process through a structured sequence of operations:</p><ul><li><strong>Input Collection:</strong> The agent prompts the user for core journey parameters, including the destination and the desired timeframe.</li><li><strong>Condition Assessment:</strong> The system analyzes surf forecasts for the specified dates.</li><li><strong>Conditional Logistics Processing:</strong> If the environmental conditions meet the predefined quality threshold, the agent executes the following:<br>- <strong>Availability Audit:</strong> It cross-references the user’s professional calendar to verify availability.<br>- <strong>Travel Sourcing:</strong> It identifies the optimal round-trip train itineraries.</li><li><strong>Final Recommendation:</strong> The process concludes with the agent presenting one or two concise, actionable travel options for final selection.</li></ul><p><strong>Tooling and System Integrations</strong></p><p>For an agent to transition from reasoning to execution, it requires access to <a href="https://knowledge.dataiku.com/latest/genai/agents/concept-agent-tool-overview.html#concept-overview-of-agent-tools">tools</a> — modular functions that allow it to interact with external data sources and services. To support the defined workflow, the following integrations were implemented:</p><ul><li><strong>Transportation Management:</strong> Utilizing the <strong>Navitia API</strong> to query real-time train schedules and availability.</li><li><strong>Schedule Coordination:</strong> Leveraging the <strong>Google Calendar API</strong> to audit user availability and cross-reference professional commitments.</li><li><strong>Environmental Data:</strong> Integrating the <strong>OpenMeteo API</strong> to retrieve precise surf conditions and wave forecasts.</li></ul><p><strong>Agent Architecture</strong></p><p>With the requirements defined, we can outline the agent’s structural architecture. The system is designed around a multi-stage workflow to ensure precise execution and error handling:</p><ul><li><strong>Intent Classification — </strong><strong>route_intent:</strong> The initial node identifies the user’s intent. This serves as a primary filter to ensure the agent responds accurately, particularly when handling out-of-scope queries or non-surf-related requests.</li><li><strong>Information Parsing — </strong><strong>update_trip_details:</strong> This node processes the user’s input to extract relevant parameters and determines the subsequent logic path:<br>- <strong>Incomplete Data:</strong> If essential parameters are missing, the workflow triggers the request_missing_detailsnode to prompt the user for the necessary information.<br>- <strong>Complete Data:</strong> Once all parameters are validated, the system moves to the execution phase.</li><li><strong>Execution and Orchestration:</strong> The planning phase consists of two primary components:<br>- <strong>Environmental Validation:</strong> A deterministic Python function verifies surf forecasts against user preferences.<br>- <strong>Travel Planning:</strong> An autonomous agent, using a <strong>ReAct (Reasoning and Acting) loop,</strong> orchestrates the logistics.</li><li><strong>Response Generation:</strong> The workflow concludes by providing a concise summary of the proposed itinerary and travel options.</li></ul><p>The following state diagram illustrates the agent’s workflow. To distinguish between execution types, nodes are color-coded as follows:</p><ul><li>Blue Nodes: Represent deterministic logic (standard code or rule-based processing).</li><li>Pink Nodes: Represent LLM-powered decision points or generative tasks.</li></ul><p>Conditional edges are named after the output of the decision function.</p><p>Note: While request_missing_detailsand handle_errorare currently driven by the LLM, these could also be transitioned to deterministic functions.</p><figure><img alt="graph of the agent" src="https://cdn-images-1.medium.com/max/1024/1*pUjdDOeui4Ei0UCDWz6zuQ.png" /><figcaption>Graph of the agent</figcaption></figure><h3>Developing Agents With LangGraph</h3><h4>Core Components</h4><p>The architecture of a LangGraph agent is built upon several core components that manage the orchestration of logic and data flow:</p><ul><li><strong>The Graph:</strong> This serves as the primary orchestration layer. It defines the overall workflow and the specific sequence of operations by connecting nodes via edges.</li><li><strong>Nodes:</strong> These are the functional units of the graph. In practice, nodes are Python functions designed to execute discrete tasks. They ingest the current state, process information, and return updates to be merged back into that state.</li><li><strong>Edges:</strong> These define the transition logic between nodes. Edges can be static, following a predetermined path, or conditional, allowing for dynamic routing based on the agent’s reasoning or external data inputs.</li><li><strong>State:</strong> Functioning as the agent’s persistent memory, the state is a shared schema maintained throughout the execution lifecycle. It enables seamless data persistence and communication between different nodes as the workflow progresses.</li></ul><p>To ensure long-term readability and maintainability, it is highly recommended to adopt a modular structure by decoupling component definitions into distinct files or packages. The following directory structure illustrates the architectural organization implemented for this code-based agent:</p><pre>surf_planner/<br>└── agent/<br>    ├── tools/<br>    ├── __init__.py<br>    ├── build.py<br>    ├── edges.py<br>    ├── graph.py<br>    ├── helpers.py<br>    ├── nodes.py<br>    ├── prompts.py<br>    └── state.py<br>└── apis/<br> config.py</pre><p><strong>graph.py</strong></p><p>This file defines the agent’s graph architecture. It serves as the orchestration layer, utilizing nodes and edges to formalize the structural logic and execution flow of the agent’s workflow.</p><pre>workflow = StateGraph(AgentState)<br><br># --- 1. ADD NODES ---<br>workflow.add_node(&quot;route_intent&quot;, partial(node_route_intent, ...))<br>.../...<br><br># --- 2. ADD EDGES &amp; ROUTING ---<br>workflow.set_entry_point(&quot;route_intent&quot;)<br>workflow.add_edge(&quot;request_missing_details&quot;, END)<br>.../...<br><br># --- 3. BUILD AGENT ---<br>agent = workflow.compile()</pre><p><strong>nodes.py</strong></p><p>This file houses the functional definitions of the agent’s nodes. In this architecture, nodes represent discrete tasks implemented as Python functions. A recommended best practice is to prefix these functions with node_ to maintain a clear distinction within the codebase. The internal logic of these nodes typically follows a consistent execution pattern: accessing the current state, performing the designated operation, and returning a state update.</p><pre>def node_route_intent(state: AgentState, model):<br>    # 1. Read inputs from state<br>    msgs = &quot;\n&quot;.join([f&quot;{msg.content}&quot; for msg in state[&quot;messages&quot;]])<br>    .../...<br><br>    # 2. Do something<br>    classifier_chain = route_intent_prompt_template | model<br>    .../...<br><br>    #3. Return the update of the state<br>    return {&quot;current_intent&quot;: intent}</pre><p><strong>edges.py</strong></p><p>This file manages the transitions between nodes. While many transitions are deterministic and follow a fixed path, conditional edges facilitate dynamic routing. These are defined as functions that analyze the current State to determine the most appropriate subsequent node based on the agent’s internal logic.</p><pre>def edge_after_update(state: AgentState) -&gt; str:<br>    # 1. Read inputs from state<br>    details = state.get(&quot;trip_details&quot;, {})<br>    .../...<br><br>    # 2. Apply some logic<br>    if all(details.get(key) for key in mandatory_keys):<br>        # 3. Return the next node<br>        return &quot;details_complete&quot;<br>    else:<br>        # 3b. Return the next node<br>        return &quot;details_incomplete&quot;</pre><p><strong>state.py</strong></p><p>The <strong>State</strong> serves as the agent’s persistent memory. It is fundamentally a schema — typically implemented as a TypedDict — that allows for the storage and retrieval of attributes throughout the execution lifecycle. In this implementation, the state includes a dedicated object to track trip details, ensuring that contextual data is seamlessly maintained and accessible across all nodes in the workflow.</p><pre>class TripDetails(TypedDict, total=False): ...<br><br>class AgentState(TypedDict):<br>    messages: Annotated[List[BaseMessage], add_messages]<br>    trip_details: TripDetails<br>    .../...</pre><p>To finalize the agent’s construction, we must define and implement the specific tools required for execution and external interaction.</p><h4>Tools Implementation</h4><p>Tools are modular Python functions (though alternative structures, such as class-based implementations, are also supported) that augment the agent’s capabilities, enabling it to act autonomously. They should be viewed as specialized skills — for instance, a function dedicated to retrieving real-time surf forecasts.</p><p>To ensure the agent can utilize these functions effectively, it requires a clear definition of the tool’s purpose and its required parameters. In the implementation below, a tool is declared using the @tool decorator. The function’s <strong>docstring</strong> serves as the primary description interpreted by the LLM, while the <a href="https://pydantic.dev/docs/validation/latest/get-started/"><strong>Pydantic</strong></a><strong> model</strong> provides a structured schema for the arguments.</p><p><strong>Key Considerations for Tool Design</strong></p><ul><li><strong>Type Hinting:</strong> Explicitly defining the types for both inputs and outputs is a best practice that ensures code clarity and facilitates easier debugging.</li><li><strong>Dependency Injection:</strong> In the provided example, the tool requires an external API client (e.g., a geolocator). This is managed via a <strong>wrapper function</strong>, allowing the client to be instantiated once and reused. While it is possible to instantiate clients directly within a tool, using a wrapper is more efficient; agents are not intended to manage the lifecycle of complex dependencies.</li></ul><pre>class SurfForecastArgs(BaseModel):<br>    spot: str = Field(description=&quot;The name of the surf spot or town.&quot;)<br>    .../...<br><br># Tool<br>def create_surf_forecast_tool(geolocator: GeolocatorAPIClient, openmeteo: OpenMeteoAPIClient):<br>@tool(args_schema=SurfForecastArgs)<br>def get_surf_forecast(spot, from_date, to_date) -&gt; list[DailySurfForecast]:<br>    &quot;&quot;&quot; Retrieve the surf forecast for a specific spot between two dates.&quot;&quot;&quot;<br>    location = geolocator.get_coordinates(spot)<br>    forecasts_data = openmeteo.get_forecasts(...)<br>    return [DailySurfForecast(...) for f in forecasts_data]<br><br>return get_surf_forecast</pre><p>The following tools were implemented for this project:</p><ul><li><strong>Surf Forecast Tool:</strong> Retrieves real-time wave conditions and meteorological data via the <strong>Open-Meteo API</strong>.</li><li><strong>Rail Logistics Tool:</strong> Interfaces with the <strong>Navitia API</strong> (SNCF) to identify and source available train itineraries.</li><li><strong>Calendar Integration Tool:</strong> Audits schedule availability by querying the <strong>Google Calendar API</strong> to ensure trip feasibility.</li></ul><h4>Strategic Advantages of Code-Based Implementation</h4><p>Developing an agent programmatically offers several distinct advantages for complex automation:</p><ul><li><strong>Design Flexibility:</strong> Code-based development allows for highly specialized and tailored workflows. This enables the creation of intricate logic structures — such as the graph-based architecture discussed earlier — that define exact operational behaviors.</li><li><strong>Granular Control Over LLM Logic:</strong> Developers gain direct oversight of context management and prompt engineering for specific “intelligent” components. This ensures precise control over how individual nodes and tools interact with the underlying model.</li><li><strong>Operational Optimization:</strong> Implementation at the code level facilitates bespoke optimizations, such as managing API session persistence and optimizing data retrieval patterns to improve performance and reduce latency.</li></ul><p>Furthermore, leveraging the <strong>LangChain and LangGraph</strong> ecosystem streamlines development through:</p><ul><li><strong>Asynchronous Execution:</strong> Simplified implementation of streaming and asynchronous calls for better responsiveness.</li><li><strong>Standardized Syntax:</strong> Utilization of <strong>LCEL (LangChain Expression Language)</strong> for cleaner, more readable code.</li><li><strong>Built-In Observability:</strong> Integrated features like automated tracing provide comprehensive monitoring of node inputs and outputs by default.</li></ul><p><strong>Note:</strong> While a code-first approach offers maximum control, it also introduces significant complexity. This level of customization should be reserved for advanced requirements; in many scenarios, native no-code agentic features provide sufficient functionality to meet business objectives.</p><h3>Implementation Insights</h3><h4>Development Environment</h4><p>To accommodate the extensive coding requirements of this project, I opted for a local development workflow using <strong>PyCharm</strong>. While integrated options like Dataiku’s <strong>Code Studio</strong> are available, a local IDE provides the necessary flexibility and robust tooling required for this specific build.</p><p>The objective was to establish a seamless pipeline: developing and testing the agent locally before deploying it within the Dataiku environment. A primary focus of this setup was maintaining a <strong>portable codebase</strong> — minimizing the need for environment-specific configurations — to ensure the agent operates consistently whether running in a local terminal or within the Dataiku platform.</p><p><strong>Project Libraries</strong></p><p>The implementation leverages <a href="https://knowledge.dataiku.com/latest/code/shared/concept-shared-code.html#concept-shared-code"><strong>Project Libraries</strong></a>, a centralized code repository within Dataiku designed for developing reusable modules. By centralizing the agent’s logic within these libraries, the code becomes highly portable and can be seamlessly imported across different platform components — most notably within the <a href="https://doc.dataiku.com/dss/latest/agents/code-agents.html"><strong>Code Agents</strong></a>.</p><p>This approach ensures a clean separation between the core logic and the platform’s orchestration layer, facilitating better version control and modularity.</p><p><strong>Local Integration</strong></p><p>To optimize the local development cycle, I leveraged the <a href="https://developer.dataiku.com/latest/tutorials/devtools/pycharm-plugin/index.html#gsc.tab=0"><strong>Dataiku extension for PyCharm</strong></a>. This integration facilitates the seamless synchronization of local source files with <strong>Dataiku Project Libraries</strong>, ensuring that code authored in the IDE is immediately available within the Dataiku instance (It is also possible to use Git).</p><figure><img alt="PyCharm plugin usage" src="https://cdn-images-1.medium.com/max/1024/1*6PKs1rSxYxRAMoMMjyTuTA.png" /><figcaption>PyCharm plugin usage</figcaption></figure><p><strong>Remote Connectivity via the Dataiku API Client</strong></p><p>To facilitate local execution, it was necessary to mirror the Dataiku runtime environment. This was achieved by installing and <a href="https://developer.dataiku.com/latest/tutorials/devtools/python-client/index.html#building-your-local-virtual-environment">configuring the <strong>Dataiku Python API client</strong></a> on the local workstation.</p><p>This setup ensures parity between the local development environment and the Dataiku platform. Consequently, API calls to instance resources — such as datasets, managed folders, or global variables — are executed seamlessly from the local machine, providing a robust and integrated debugging experience.</p><p><strong>Deployment and Execution in Dataiku</strong></p><p>To deploy the agent within Dataiku, the initial configuration begins by <a href="https://developer.dataiku.com/latest/concepts-and-examples/agents.html#creating-your-code-agent">creating a <strong>“code agent”</strong></a> through the project’s GenAI menu. Following this, a class must be defined to implement a specific interface, which enables Dataiku to orchestrate and execute the custom code.</p><p>Specifically, it is mandatory to implement a processmethod (note that asynchronous and streaming variants are also supported). This method serves as the entry point where the agent logic — previously defined in the <strong>Project Libraries</strong> — is imported. Dataiku invokes this function whenever the agent is triggered. Once the class and its processing logic are established, the agent is fully operational within the Dataiku ecosystem.</p><p>To minimize environment-specific boilerplate and enhance portability, the implementation utilizes an AgentBuilderclass. This component is responsible for assembling the agent by injecting all necessary dependencies, such as API clients and project-level parameters, ensuring a clean and modular initialization process.</p><pre>.../...<br>from surf_planner.agent.build import AgentBuilder # from Project Libraries<br><br>class MyLLM(BaseLLM):<br>    <br>    def __init__(self):<br>        settings = ProjectSettings()<br>        client = dataiku.api_client()<br>        builder = AgentBuilder(settings)<br>        self.agent = builder.build()<br>    <br>    def process(self, query, settings, trace):<br>        messages = []<br>  # ... &lt;format input messages&gt; ...<br>        inputs = {&quot;messages&quot;: messages}<br>        final_state = self.agent.invoke(inputs)<br>        final_answer_message = final_state[&quot;messages&quot;][-1]<br>        return {&quot;text&quot;: final_answer_message.content}</pre><p>Once deployed, the agent can be leveraged across multiple channels within the Dataiku ecosystem:</p><ul><li><strong>Batch Processing:</strong> The agent can be integrated into a <a href="https://knowledge.dataiku.com/latest/genai/text-processing/tutorial-prompt-recipe.html"><strong>Prompt Recipe</strong></a> to process large-scale datasets efficiently.</li><li><strong>Programmatic Access:</strong> It can be <a href="https://developer.dataiku.com/latest/tutorials/plugins/agent/generality/index.html#using-the-agent">invoked via <strong>API</strong></a>, enabling integration into external applications or automated enterprise workflows.</li><li><strong>Conversational Interfaces:</strong> The agent can be exposed through integrated interfaces such as <strong>Agent Hub</strong>, providing a natural-language front-end for users to interact with the underlying logic.</li></ul><h4>LangSmith Studio</h4><p>The ability to run the agent locally makes the use of <a href="https://docs.langchain.com/langsmith/studio"><strong>LangSmith Studio</strong></a> seamless for advanced debugging. This tool transforms agent execution into an interactive process, providing a visual representation of the agent’s logic.</p><p>Key benefits of this local debugging workflow include:</p><ul><li><strong>Real-Time Visualization:</strong> Monitor node transitions and state updates dynamically as the agent executes.</li><li><strong>State Inspection:</strong> Gain immediate visibility into the agent’s memory (the “State”) to ensure data persistence and accuracy across the workflow.</li><li><strong>Advanced Control:</strong> Utilize breakpoints and the ability to re-run execution from a specific node using a pre-defined state.</li></ul><p>Once LangSmith is configured locally, initiating the development server is straightforward: simply run the langgraph devcommand to access the interactive visual interface and begin auditing the agent’s reasoning process.</p><figure><img alt="LangSmith Studio view" src="https://cdn-images-1.medium.com/max/1024/1*4lFAfLEQ0QCAGTFu2qzdvA.png" /><figcaption>LangSmith Studio view</figcaption></figure><h3>Chat With the Agent</h3><p>As previously highlighted, the code-based agent is integrated within the Dataiku ecosystem. For this project, we leveraged <a href="https://www.dataiku.com/stories/blog/introducing-agent-hub"><strong>Agent Hub</strong></a> — a plug-and-play web application — to provide a streamlined conversational interface for end-users.</p><p>The agent is integrated into the <strong>“enterprise agents”</strong> catalog, where we configure curated sample queries to guide user interaction. With this final configuration in place, the system is fully prepared for functional testing and deployment.</p><figure><img alt="Sample conversation in AgentHub" src="https://cdn-images-1.medium.com/max/1024/1*nKbudF-d9d3kt8_GwnrK_A.png" /><figcaption>Sample conversation in AgentHub</figcaption></figure><p>The agent prompts the user for specific journey parameters and, upon confirming that all environmental and logistical criteria are met, executes the planning workflow. The following output illustrates the agent’s performance for a sample weekend:</p><figure><img alt="The final proposal from the Agent" src="https://cdn-images-1.medium.com/max/1024/1*CmI58TIerXacvKIvDAGjnw.png" /><figcaption>The final proposal from the Agent</figcaption></figure><h3>Conclusion</h3><p>This project demonstrated how to build a sophisticated code-based agent by addressing a practical logistics challenge: automating the planning of surfing trips.</p><p>By leveraging <strong>LangGraph</strong>, we developed a robust solution that coordinates complex workflows, manages state persistence, and utilizes specialized tools to interact with external APIs. This architectural approach provides the flexibility and control necessary for handling non-linear tasks that go beyond the capabilities of standard automation.</p><p>Furthermore, we explored how a local development workflow — combining a traditional IDE with the Dataiku API client — provides an excellent developer experience.</p><p>Ultimately, this implementation serves as a successful proof of concept, showing how autonomous agents can effectively eliminate repetitive administrative tasks and streamline complex decision-making processes.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2f3d91f6ef8b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-from-the-trenches/building-a-langgraph-agent-in-dataiku-2f3d91f6ef8b">Building a LangGraph Agent in Dataiku</a> was originally published in <a href="https://medium.com/data-from-the-trenches">data from the trenches</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The 3 Layers of Agent Building]]></title>
            <link>https://medium.com/data-from-the-trenches/the-3-layers-of-agent-building-db45b52178ec?source=rss----853867ec3a23---4</link>
            <guid isPermaLink="false">https://medium.com/p/db45b52178ec</guid>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[agent-harness]]></category>
            <dc:creator><![CDATA[Pierre Petrella]]></dc:creator>
            <pubDate>Mon, 06 Jul 2026 15:48:43 GMT</pubDate>
            <atom:updated>2026-07-06T15:48:42.016Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="agent building image with brain in the center" src="https://cdn-images-1.medium.com/max/1024/1*m9De-nHDSiVR1vEv5bgyCg.png" /></figure><p>Harness engineering has become a hot topic and seems to be ever evolving. What framework or architecture should it use? What capabilities should it include? How do I know if it is good enough? How do I make it safe and reliable? What even is an agent harness?</p><p>At Dataiku, we worked with <strong>60+</strong> enterprise customers across multiple industry verticals to help them deliver agents in production from which we’ve been able to identify AI agent building patterns.</p><p>We distilled all these agent building learnings into this article, splitting the agent building process into three layers: the model, the agent harness, and the agent harness configuration.</p><h3>Layer 1: The Model</h3><p>The first thing to remind ourselves is that an agent is a powerful system and, at its core, it boils down to a <strong>smart orchestration of LLM calls</strong>. The system that <strong>handles and orchestrates LLM calls within an agent</strong> is what we will call the <strong>agent harness.</strong></p><p>LLM output generations can be structured to enable <strong>tool calling</strong>, the <strong>ability of an LLM to request for an action to be performed, </strong>which has become the backbone of all agentic systems<strong>.</strong></p><p>The challenge is that a single LLM call is only able to “request” for a tool to be called, it doesn’t directly have the ability to execute it. That means that we still have to call the requested tool on behalf of the model for the action to be performed. This motivates the need for the second layer: the agent harness.</p><h3>Layer 2: The Agent Harness</h3><p>Historically, agentic systems were limited by their underlying model’s performance. Recently, the limiting factor has shifted to the agent harness. More real-world agent harness benchmarks like <a href="https://www.tbench.ai/">Terminal-Bench</a> showcases how significant performance improvement can be achieved and attributed solely to agent harness optimizations.</p><p>That being said, with new agent harness features and capabilities being released on an almost daily basis, it can get complicated to focus on the ones that will survive long term versus the brittle features destined to be eaten by the next big model release feature, commonly known as “<strong>agent scaffolding.</strong>”</p><h3>Agent Harness Core Model Loop</h3><p>To give more agency to a model, we want to build a mechanism to inform the model of their previous action’s result so it can decide to perform another action OR give its final answer. This looping mechanism typically follows the<a href="https://arxiv.org/abs/2210.03629"> ReAct Framework</a> and is a foundation feature of any agent harness.</p><p>We found that the agent harness’s core loop can be reduced to a repeating cycle of five steps:</p><ol><li><strong>Input Request</strong>: This can be a new user request, a user clarification, or the result of the previous core model loop iteration.</li><li><strong>Context Engineering</strong>: This step focused on assembling all the context the model needs for its next generation including general LLM guidelines saved in the system prompt, user preferences, historical conversation &amp; steps taken, current plan, expertise instructions, and retrieved data.</li><li><strong>Equip Relevant Tools</strong>: Select and attach the tools available to the model for this turn. These are generally kept the same but could be updated based on the task requirements.</li><li><strong>Run the Model: </strong>Choose the right model to run based on task complexity/cost requirements and execute it with the assembled context and tools that handle model errors and retries.</li><li><strong>Harness Housekeeping</strong> (where most of the complexity lies): Also known as hooks or middleware, this step parses the model outputs; executes any requested tool or sub-agent call while handling errors and retries; applies guardrails; provides observability and logging; manages memory; tests the agent’s work and calls for user intervention when needed (human in the loop).</li></ol><p>At the end of each cycle, a decision is made to<strong> </strong>return a final response OR feeds the result of the current cycle into the start of the next one and kicks it off.</p><figure><img alt="agent harness lifecycle five-step orchestrator loop" src="https://cdn-images-1.medium.com/max/1024/1*7TbsZR_35to0cLKP7qyKGw.png" /></figure><p>Most of the core agent harness features we will cover are built on top of this core model loop and apply to multiple steps of the harness cycle. They can shape context in step 2, provide tools in step 3, and enforce rules in step 5.</p><h3>Simple Agent Harness Limitations</h3><p>We started implementing agents with the simplest harness possible: a core loop. In theory, an agent harness equipped with a core model loop, with the right tools to interact with its environment and a capable model should be enough to complete any task.</p><p>In practice, we found that it was not the case. As tasks get longer and more complex, a bare core model loop harness runs into problems like:</p><ul><li><strong>Context Rot </strong>when information in the context gets out of date or irrelevant.</li><li><strong>Context Anxiety</strong> when the model ends early when it approaches its context window.</li><li><strong>Tool Pollution </strong>when tool descriptions drown the context.</li><li><strong>Infinite loops</strong> when getting stuck in a local minima.</li><li><strong>Lack of visibility and trust </strong>as harness reasoning can become an unconstrained blackbox.</li></ul><figure><img alt="context rot, context anxiety, infinite loop" src="https://cdn-images-1.medium.com/max/724/1*NH3tm6Nun-r3zBPEU8d8xg.png" /></figure><h3>Agent Harness Design Principles</h3><p>This motivated the need to add more features to our harness to remediate the issues listed above. Through trial and error, we noticed that to avoid building unnecessary “agent scaffolding,” the following <strong>design principles </strong>have reliably helped produce versatile and robust agent harness features.</p><ul><li><strong>Progressive Disclosure</strong> — As agent working environments start getting more and more complex, agent harnesses should be designed to dynamically allow discovery, navigation and deep dive into knowledge about that environment based on the assigned task.</li><li><strong>Design for Reliability not Capability — </strong>You can have all the capabilities in the world, but if you can’t trust the agent, its value and usability drops to zero.</li><li><strong>Build for the Models of Tomorrow </strong>— Build features that work for the model today and that will allow future better model versions to grow into the harness and not be restricted by it.</li></ul><h3>Agent Harness Feature Implementation Patterns</h3><p>When implementing a harness feature, we found that we needed to choose the level of autonomy which ended up falling into one of four <strong>implementation patterns</strong>. Let’s take the agent memory feature ordered by increasing level of model agency as an example:</p><ol><li><strong>Fully Handled by the Harness</strong>: The harness manages the feature end to end, invisible to the model. Ex: At the start of each turn, relevant user preferences &amp; memory fragments are injected automatically into the context by the harness.</li><li><strong>Specialized Tool-Based Capability</strong>: The model is given access to the capability via hyper-specific tools<strong>,</strong> with some light agent harness housekeeping. Ex: The agent is given specific memorizing and remembering tools that include deduplication of memory fragments.</li><li><strong>High-Level Instruction</strong>: The model is <strong>instructed</strong> at a high level how to implement and run the feature via core multi-purpose generic tools. Ex: The harness is instructed to save and load any relevant user information in a user/memory.md file, segmenting the memory by type.</li><li><strong>Full Autonomy</strong>: The model<strong> just knows</strong> that the feature is required, decides on how to implement it, and how to use it. Ex: The model decides to build a memory system and leverages the generic tools available to spin up a database or file systems structure as appropriate.</li></ol><figure><img alt="agent harness feature implemtnation patterns" src="https://cdn-images-1.medium.com/max/1024/1*_-K6NdtyOFXIe4em5Dp65A.png" /></figure><p>As models get better, harness builders naturally start to favor implementing harness features in the 3–4 buckets. This naturally increases agent entropy, making controlling, standardizing, and monitoring agent behaviors more challenging. Working mainly with enterprise agents, all the harness features we implemented landed in the 1–3 range for control and auditability reasons, with any feature related to access control and security kept in the first bucket.</p><h3>Agent Harness Core Features</h3><p>It is finally time to dive into the features we ended up equipping our enterprise agents.</p><p>We can divide these harness features into two categories. Let’s use a car as an analogy to motivate both categories. The car’s purpose is to get you from A to B, and the agent’s purpose is to execute (hopefully) valuable tasks delegated to it. The car, same as the agent harness, has <strong>two conflicting</strong> <strong>missions </strong>to achieve:</p><ol><li><strong>Performance: Get from A to B in the fastest way possible</strong> by<strong> </strong>converting as much raw motor power into speed, with the motor being the model and the car being the harness capabilities.</li><li><strong>Safety: Keep the car from crashing or breaking down</strong> by providing reliable brakes, well maintained parts, etc. Here, the brakes would be the safety, reliability, and observability features within the agent harness.</li></ol><h3>Mission 1: Performance</h3><p>A performant agent harness does two things well:</p><ol><li>Gives the model access to the right context at the right time</li><li>Gives the model powerful and versatile tools to explore and interact with its environment.</li></ol><p>Intuition tells us that if we want an agent to be as versatile as a human when assigned tasks, we need to equip it with the same tools that a human would use. Nowadays, most knowledge work can be done remotely via a computer and an internet connection. The idea therefore is, what if we give the agent access to a computer and an internet connection?</p><p>For the last 80+ years, the terminal has been the main text-based entrypoint into any computer, a medium that LLMs are known to be very good at. Terminal access would then allow agents to:</p><ol><li><strong>Progressively disclose</strong> information via the <strong>file system</strong>: This is done by leveraging commands like cat, grep, find, etc.</li><li><strong>Persist information and work</strong> over time<strong> </strong>by<strong> writing/editing files </strong>to the filesystem<strong>: </strong>This allows the agent to progressively save data and decompose and perform complex tasks step by step.</li><li><strong>Execute code via </strong>runtime environments: This allows the agent to run previously written or pre-existing scripts to execute complex predefined logic or deploy complete applications.</li><li><strong>Call third-party applications</strong>: This allows the agent to call any existing tool, software, or application, provided they have a command line interface (CLI) like curl, ssh, run cron jobs, etc. to further interact with their environment to perform their test.</li><li>Leverage <strong>built-in Operating System</strong> (OS) features: This allows the use of the underlying hardware, access control &amp; security, and networking native features.</li></ol><p>Terminal access is necessary but not sufficient, as the models of today still need a bit more structure and guidance from the agent harness to efficiently use these <strong>low-level, powerful primitives </strong>provided by the terminal to reliably perform requested tasks. This is why we still equipped our agent harnesses with higher-level functionalities like:</p><ul><li><strong>General</strong> <strong>system prompt</strong> providing guidance agnostic to the task at hand.</li><li><strong>Planning</strong> to decompose any task into manageable subtasks and track their progress.</li><li><a href="https://agentskills.io/"><strong>Skills</strong></a> to provide structured instruction &amp; tribal knowledge discoverability to perform specific tasks.</li><li><a href="https://en.wikipedia.org/wiki/Retrieval-augmented_generation"><strong>RAG</strong></a> to dynamically enrich the context with relevant data.</li><li><strong>Context management/reduction</strong>, a subsection of context engineering that allows the agent to keep their context as relevant as possible as the task horizon increases.</li><li><strong>Memory</strong> allows the agent to simulate remembering preference, facts, and procedures between turns and sessions.</li><li><strong>Self evaluation/correction loops</strong> via systems like the <a href="https://ghuntley.com/loop/">ralph loop</a> that systematically reviews the work of the main agent to validate that the job is completed.</li></ul><h3>Mission 2: Safety</h3><p>The faster and longer agents can do things, the faster mistakes can happen and compound. The more freedom and access the agents are given, the more dangerous those mistakes can become, which is why equipping the right agent “brakes” is equally, if not more important.</p><p>When it came time to build our agent harnesses, we made sure to provide the right level of <strong>security</strong>, <strong>reliability</strong>, and <strong>observability</strong>.</p><p><strong>Security</strong> involves access control and prevention from malicious intent:</p><ul><li><strong>User-level access control</strong> should be applied for every action performed by the model on behalf of the calling user, respecting that user’s permissions.</li><li><strong>A secure sandbox for code executions </strong>provides a safe environment to run agent-triggered code, separated from the existing agent environment following least privilege principles.</li><li><strong>Prompt injection prevention</strong> is needed for ingestion of uncontrolled or unverified data sources such as from web scraping or from external emails that should be vetted for any potential malicious intent, especially when in the <a href="https://simonwillison.net/2025/Jun/16/the-lethal-trifecta/">lethal trifecta</a> situation.</li></ul><p><strong>Reliability </strong>involves giving confidence in the agent abilities and maintainability via versioning and rollback of work capabilities and resilience in runtime execution failures:</p><ul><li><strong>Versioning &amp; rollbacks</strong> allows the user to see the history of changes and actions taken and rollback to an older state if needed, erasing all actions performed in between.</li><li><strong>Core harness cycle error management</strong> is the capability that allows the harness to handle errors within its cycle like LLM call errors, LLM output parsing error, tool calling errors, infinite loop detection, or context limit management.</li></ul><p><strong>Observability</strong> provides transparency and auditability to the overall system, all while delivering the right level of agency to the agent user:</p><ul><li><strong>Agent interaction logging </strong>has two components, the agent execution logs captured in the form of a trace that contains all the steps taken by the agent and the agent runtime logs emitted by the agent’s runtime environment throughout a run.</li><li><strong>Live async user feedback</strong> informs the user on what is currently being worked on, what is the current plan and where human sign off is required. The right level of feedback loop can make or break your harness.</li></ul><p>Each of these categories and sub topics could warrant their own article but it is important to know that they should be considered when designing the agent harness.</p><p>In practice, <strong>building a harness from scratch can be technically challenging, time consuming, </strong>and with the AI space rapidly changing, it is easy to quickly accumulate technical debt. Agent harnesses will also most likely end up getting <strong>standardized and commoditized</strong> in the near- to medium-term, making it an overall low return on investment to build one from scratch if it is not core to the business.</p><p>It is much more worthwhile to focus time and effort on the real agent-building value generator: the third layer of the agent building process, the configuration of the agent harnesses.</p><h3>Layer 3: The Agent Harness Configuration</h3><p>The agent harness provides a fast car with adequate brakes, but we are still missing the wheels, so to speak. Only when the agent is given <strong>access to the right use case/environment-specific context and tools</strong> will it actually be able to hit the road and showcase that valuable performance.</p><p>To configure an agent harness, you first need to identify and define the use case that would benefit from an agent. This exercise can end up being more challenging than it seems, so we put together a simple and intuitive framework to help answer the question, “<a href="https://medium.com/data-from-the-trenches/how-can-you-identify-an-agentic-ai-use-case-b95b3fa45600">How can you identify an agentic use case?</a>”</p><p>Once the <strong>agent’s core five characteristics</strong> (from the framework above) have been identified and documented, the agent harness can be configured following the next six steps.</p><ol><li><strong>Giving the Agent Access to Context</strong></li></ol><p><strong>Context is king</strong>. Provide the right context and the rest will follow. This can be done by giving general guidance via the system prompt (ex: AGENT.md) or providing procedural knowledge via skills, ranging from tribal knowledge to internal tool documentation to company-approved formats for building slide decks or reports.</p><p><strong>2. Giving the Agent Access to Use Case/Environment-Specialized Tools</strong></p><p>On top of the built-in tools to the harness, the agent needs to be given access to the right read and write tools to properly interact with its environment. <strong>READ tools</strong> are needed to query CRM data, news data, shared emails, semantic data models or unstructured shared drive folders. <strong>WRITE (action) tools </strong>allow the agent to<strong> </strong>not only inform but do things for the user like submit draft email, generate pptx/doc, build data visualizations, submit a transaction, write/run code scripts, etc.</p><p>Tools implementations can range from MCP servers to CLIs. As a rule of thumb, the more generic tools, the better. Tools can be made more or less specific based on model performance and requirements for strict guardrails or auditability. As an example, a supply chain agent could have full generic access to a CRM to “create” a PO for the user OR could be required to explicitly call a “submit PO” tool which automatically triggers the proof-reading workflow before submission.</p><p><strong>3. Set Up the Right Level of Permissioning</strong></p><p>The moment the agent is user facing and is connected to internal/external systems, role-based permissioning should become top of mind. For each of the previously defined tool calls, the agent should act on behalf of the calling user and respect the Role Based Access Control (RBAC) policies set on the underlying system via Oauth or at the agent harness level via pre-tool call hooks to avoid any permission leaks.</p><p><strong>4. Human-in-the-Loop Requirements</strong></p><p>Once you have your tools defined and set up with the right permissions, deciding on the right “intervention threshold” is crucial. Too many human interventions can cause decision fatigue and kill the calling user’s productivity, but too little can risk irreversible actions being made, non-compliance with company and legal regulations, and lost confidence in the system as a whole.</p><p><strong>5. Equipping Sub-Agents</strong></p><p>An agent can be powerful, but give it a team to delegate to, allowing it to handle much more complex tasks and run for longer. Equipped sub-agents can either be generalist sub-agents to perform a specific delegatable subtask or hyper specific sub-agents for specific tasks like running deep research or a full review of the main agent’s work via a curated test suite following a testing framework like Test-Driven Development (TDD).</p><p><strong>6. Integrating the Agent Into Existing Processes</strong></p><p>Your agent might have all the functionalities in the world, but if it does not fit into core processes and doesn’t have an appropriate interface, it won’t have the expected value add. Chat interfaces, albeit intuitive interfaces for agents, are only one way of embedding an agent and rarely the most efficient to interface with an agent. Agents can also be kept running in the background as batch automation or live triggered by events like email receipts, alerts, or other notifications.</p><p>A key takeaway is that once our agent harness was built, we didn’t really need to touch it anymore. Value starts being unlocked once the agent harness actually gets configured to fit the use case. This means, giving the agent access to the relevant context, integrations and systems required for the tasks you plan to delegate to it.</p><h3>Conclusion</h3><p>We rely on the agent harness to bridge the gap between the model and its environment allowing it to perform meaningful and valuable tasks the same way that we rely on the computer’s OS and programming languages to bridge the gap between high level business applications and the underlying CPU and RAM.</p><p>It is looking like LLMs will soon become a commodity (if not already) thanks to the open-source community publishing open weights of very powerful models and fierce competition between the model vendors bringing the cost of models down. Agent harnesses are the next in line as agent harness architectures will start converging, driven again by the open-source community projects like OpenClaw or Langchain’s Deep Agents, industry-leading agent harnesses like Anthropic’s Claude Code, Google’s Antigravity, OpenAI’s Codex and incentives for labs to post-train models to work well with specific harness architectures.</p><p>One thing that only time will tell is, with models starting to support more and more modalities and possibly transition over to world models, would the core harness primitives we’ve built still hold or would a new harness paradigm emerge?</p><p>Either way, at least in an enterprise setting, the best use of time and effort remains on the <strong>last mile configuration</strong> of the agent harnesses as it allows a model to<strong> </strong>effectively<strong> interact and understand </strong>your<strong> one-of-a-kind environment</strong>, your data, and your processes; all in a reliable and safe way. This is possible via solutions and platforms like Dataiku that offer prebuilt <strong>agent-harnesses-as-a-service,</strong> considerably reducing technical debt and empowering developers to <strong>focus on the last mile agent configuration </strong>to translate their business and industry knowledge into an agentic system in a centralized agent control plane.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=db45b52178ec" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-from-the-trenches/the-3-layers-of-agent-building-db45b52178ec">The 3 Layers of Agent Building</a> was originally published in <a href="https://medium.com/data-from-the-trenches">data from the trenches</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Multi-Agent Systems Demystified: How to Pick the Right Architecture and Framework for Your Task]]></title>
            <link>https://medium.com/data-from-the-trenches/multi-agent-systems-demystified-how-to-pick-the-right-architecture-and-framework-for-your-task-0c4cce51be50?source=rss----853867ec3a23---4</link>
            <guid isPermaLink="false">https://medium.com/p/0c4cce51be50</guid>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[multi-agent-systems]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[generative-ai-use-cases]]></category>
            <dc:creator><![CDATA[Camille COCHENER]]></dc:creator>
            <pubDate>Mon, 02 Feb 2026 20:00:43 GMT</pubDate>
            <atom:updated>2026-02-02T20:00:41.959Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="image of many blue buildings" src="https://cdn-images-1.medium.com/max/1024/1*MhySSwSc3MFxeYbQhceXOQ.jpeg" /><figcaption>Image from <a href="https://unsplash.com/fr/@dianamia">C Dustin</a> on <a href="https://unsplash.com/">Unsplash</a></figcaption></figure><p><em>Blog post co-written with </em><a href="https://medium.com/u/738ec8ed0dec"><em>François Phe</em></a></p><p>Building generative AI applications is no longer just about using one powerful language model. Today, the real challenge is <strong>designing systems made of several specialized LLM agents (or AI agents) that work together to solve complex problems</strong>. The hard part is not only deciding <em>what</em> to build, but also figuring out <em>how</em> to build it in practice.</p><p>You are facing a complex problem, and you know that using several LLM agents together is the right approach. But a key question quickly comes up: How should these agents be organized? Should they follow a clear hierarchy, operate as a flexible group with more dynamic, non-deterministic interactions, or adopt a hybrid approach with a portion of deterministic task flows? And which framework should you use to build this system, i.e., LangGraph, AutoGen, CrewAI, or something else?</p><p>This represents a new form of choice overload in the field. The way you organize your agents acts like a playbook: It can either help your system run smoothly or lead to confusion and poor results.</p><p><strong>What Are Multi-Agent Systems?</strong></p><p>A multi-agent system is a setup where <strong>several LLM agents interact with each other to solve a problem</strong>. Instead of relying on one single, all-purpose agent, you build a small team of specialists, such as a researcher, a writer, or a reviewer, who work together on the same task.</p><p>The architecture is the rulebook for this team, including:</p><ul><li>Who can talk to whom</li><li>Who makes decisions</li><li>How tasks move from one agent to another</li></ul><p><strong>Choosing the right architecture is critical</strong>. It directly affects how much control you have over the system and how well it can scale. <em>In this blog post, you’ll find practical advice to help you understand these options and pick the right design and associated framework for your own application.</em></p><h3><strong>Defining the Landscape</strong></h3><p>Before comparing solutions, let’s clarify two key ideas:</p><ul><li><strong>Architectures: </strong>How agents are organized</li><li><strong>Frameworks: </strong>The software libraries you use to build them</li></ul><p>You can think of architectures as blueprints, and frameworks as toolkits.</p><h4><strong>Common Multi-Agent Architectures (The “Blueprints”)</strong></h4><p>We will focus on the most widely used MAS architectures.</p><p><strong>Hierarchical (or Supervisor)</strong></p><p>This is a top-down model, similar to a manager leading a team. One supervisor agent is in charge: It evaluates the request, selects the appropriate next actions, and routes well-defined tasks to worker agents.</p><p>Each agent runs, produces an output, and hands the result back to the supervisor, which then determines what to do next.</p><p>Several common forms of this hierarchical pattern include:</p><ul><li><strong>Simple Supervisor (Tool Calling)</strong>: In the simplest version, the supervisor treats other agents as callable tools. Using the LLM’s tool-calling feature, it selects which agent to invoke and provides the corresponding input.</li><li><strong>Complex Hierarchy</strong>: For larger or more complex systems, the hierarchy can be extended. Instead of one supervisor managing all agents, you may have multiple layers of supervision. In this setup, a top-level supervisor delegates work to sub-supervisors, each of which manages its own small group of agents. These “pods” allow the system to handle more complex workflows while keeping responsibilities clearly separated.</li></ul><figure><img alt="Examples of hierarchical architectures" src="https://cdn-images-1.medium.com/max/1024/1*aTmVCxPK6ovMME9XluVzEQ.png" /><figcaption>Examples of hierarchical architectures</figcaption></figure><p><strong>Network (or Swarm)</strong></p><p>This is a decentralized architecture where all agents are equals and there is no single leader controlling the system. Agents communicate directly with one another, often through a shared conversation, and adjust their actions based on the existing conversation state.</p><p>Any agent can contribute at any time by proposing ideas, responding to others, or refining previous outputs. Through this ongoing interaction, agents can challenge, review, and improve each other’s work, allowing the system to gradually converge toward a higher-quality final result.</p><figure><img alt="Example of a network architecture" src="https://cdn-images-1.medium.com/max/630/1*0B8Ys0OV9-qMnLRV1ejt7Q.png" /><figcaption>Example of a network architecture</figcaption></figure><p><strong>Custom Workflow</strong></p><p>In a custom workflow architecture, you explicitly design the execution flow between agents. You decide how agents are connected and how tasks move through the system, using sequential steps, conditional branches, loops, or parallel execution. This approach does not rely on open-ended agent interactions or a central supervisor; instead, the behavior of the system is defined by the workflow itself, giving you full control over how it operates.</p><figure><img alt="Example of a custom workflow architecture" src="https://cdn-images-1.medium.com/max/1024/1*6YYZ0q8sfAocvRO3feQAgA.png" /><figcaption>Example of a custom workflow architecture</figcaption></figure><h4><strong>Popular Agent Frameworks (The “Toolkits”)</strong></h4><p>Frameworks provide the building blocks to implement these architectures.</p><ul><li><strong>LlamaIndex: </strong>In LlamaIndex, an agent combines an LLM with memory and tools. You can create agent workflows using ready-made components (such as FunctionAgent or AgentWorkflow) or build fully custom, event-driven processes.</li><li><strong>LangGraph: </strong>LangGraph models systems as graphs. Each node represents a tool, a decision step, or an agent. Multi-agent systems are created by connecting these nodes and defining how messages and state move between them. For very common architectures, pre-built graphs exist (e.g., create_swarm, create_supervisor).</li><li><strong>AutoGen: </strong>AutoGen lets you create agents using the AssistantAgent class. It is excellent for conversational patterns like multi-agent debates or group chats.</li><li><strong>CrewAI: </strong>CrewAI is a lightweight Python framework focused on production use. It enables role-based agents with clear goals to collaborate using tools, memory, and task orchestration.</li><li><strong>OpenAI Agents SDK:</strong> This SDK (Software Development Kit) enables you to build agentic AI apps in a lightweight package. Its core primitives are agents, handoffs (agents delegating to other agents), and guardrails.</li><li><strong>Google ADK: </strong>Google’s Agent Development Kit is an enterprise-grade toolkit designed for modular, maintainable hierarchies and structured workflows.</li></ul><h3><strong>Key Factors to Guide Your Choice</strong></h3><p>Choosing a multi-agent architecture or framework is not about picking the most popular option; it’s about matching the design to the problem you are trying to solve. Before diving into specific architectures and recommendations, it’s important to step back and think about a few core dimensions that shape how your system should behave.</p><h4><strong>Number of Agents</strong></h4><p>Start by identifying how many distinct roles or specializations your system really needs. Some problems can be handled by a small group of three to five agents, each with a clear responsibility. Others require a much larger setup, closer to a full organization, with many specialized agents working in parallel. The number of agents you plan to use will strongly influence both the architecture and the framework you choose.</p><h4><strong>Level of Decision Autonomy</strong></h4><p>Next, consider how much decision-making power each agent should have. In some systems, agents simply execute well-defined and assigned tasks. In others, agents independently determine the next action or which other agents to invoke. Higher autonomy can unlock more flexible behavior, but it also increases complexity and the risk of unpredictable outcomes.</p><h4><strong>Task Trajectory Complexity</strong></h4><p>Think about how the task is executed from start to finish. Is it a simple, sequential workflow with a clear path to the result, or does each request require complex branching decisions to reach a solution? This includes whether tasks follow a fixed order or can split into parallel paths. The more complex and variable the path to a solution, the more important the choice of architecture becomes.</p><h4><strong>Modularity &amp; Reusability</strong></h4><p>Finally, consider how your system will evolve over time. Will you need to add new agents, replace existing ones, or reuse the same agent across multiple systems? A modular design makes experimentation, maintenance, and scaling much easier, especially as your application grows beyond a single use case.</p><p>Taken together, these questions form a practical lens for evaluating different multi-agent designs. With these criteria in mind, we can now look at relevant examples for each multi-agent architecture.</p><h3><strong>Multi-Agent Architectures: Scenario Examples</strong></h3><p>The easiest way to understand when to use each architecture is to see how they behave in real situations. Below are <strong>three concrete use cases</strong>, each illustrating a different multi-agent design pattern.</p><h4><strong>Hierarchical Architecture: Quarterly Competitive Report</strong></h4><p>You ask the system:</p><blockquote>“Generate a Q3 competitive analysis report on ‘Competitor X’. Focus on product features, marketing campaigns, and customer sentiment.”</blockquote><p><strong>How it works:</strong></p><ul><li><strong>Supervisor (The “lead analyst agent”): </strong>The supervisor<strong> </strong>receives the request and breaks it into clear sections (product, marketing, sentiment).</li><li><strong>Specialized Agents: </strong>Each section is assigned to a dedicated agent (e.g., <em>product analyst agent</em>, <em>marketing analyst agent</em>, s<em>entiment analyst agent</em>).</li><li><strong>Parallel Execution: </strong>Agents work independently and do not need to coordinate with each other.</li><li><strong>Synthesis: </strong>The supervisor collects the outputs to assemble and review the final report.</li></ul><p>This is a strong fit for a hierarchical architecture because the task is structured, predictable, and can be split into independent research efforts.</p><h4><strong>Network Architecture: Purchase Customer Support</strong></h4><p>A customer writes:</p><blockquote>“My order #123 hasn’t arrived, and I’d also like to upgrade my subscription.”</blockquote><p><strong>How it works:</strong></p><ul><li><strong>Specialized Agents</strong>: The system includes a <em>shipping agent</em> to handle delivery issues and a <em>billing agent</em> to manage subscription and payment requests.</li><li><strong>Initial Agent: </strong>One of these agents receives the message first and determines whether it can fully handle the request or whether part of it should be routed to another agent.</li><li><strong>Autonomous Handoffs: </strong>After addressing the shipping issue, the <em>shipping agent </em>detects that the subscription request remains unresolved and transfers the conversation to the <em>billing agent</em> to complete the task.</li></ul><p>This is perfect for a network architecture because the problem is unpredictable. Control naturally moves between specialists. This approach is flexible and adaptive, which is essential for conversations that cannot be fully planned in advance.</p><h4><strong>Custom Workflow Architecture: Technical Customer Support</strong></h4><p>A customer writes:</p><blockquote>“Help! My dashboard isn’t loading”</blockquote><p><strong>How it works:</strong></p><ul><li><strong>Routing Step: </strong>A routing component classifies the request into technical and billing categories.</li><li><strong>Conditional Execution: </strong>Depending on the classification, the request is sent to either a <em>technical support agent</em> or a <em>billing agent</em>.</li><li><strong>Convergence Point: </strong>Regardless of the path taken, the response is sent to a <em>quality-control agent</em>.</li><li><strong>Final Polish: </strong>The<strong> </strong><em>quality-control agent</em> rewrites the answer to match the company’s tone and standards before sending it to the customer.</li></ul><p>This use case fits a custom workflow because it follows <strong>explicit logic rules</strong> and <strong>requires dynamic controlled routing</strong> while ensuring consistent quality through a final review step.</p><p>These examples highlight how different architectures excel under different constraints. In the next section, we’ll compare <strong>hierarchical</strong>, <strong>network</strong>, and <strong>custom workflow</strong> architectures across the key dimensions introduced earlier, number of agents, autonomy, task trajectory complexity, and modularity, to help you choose the right design for your own application.</p><h3><strong>The Great Multi-Agent Debate: </strong>Practical Guides &amp; Recommendations</h3><p>Now that we’ve explored concrete examples, let’s compare the three architectures across the four key dimensions introduced earlier.</p><h4><strong>Architecture vs. Technical Dimensions</strong></h4><p><strong>Number of Agents</strong></p><ul><li><strong>Hierarchical (High):</strong> Best suited for large systems. You can organize dozens of agents into small teams managed by intermediate supervisors, keeping the overall system structured and understandable.</li><li><strong>Network (Low):</strong> Works best with small groups. As the number of agents grows, the system quickly becomes hard to follow, making handoffs, loops, and agent interactions difficult to track.</li><li><strong>Custom Workflow (Medium):</strong> Scalability depends on the complexity of the workflow graph. It handles mid-sized teams well, as long as routing logic and execution paths remain clear.</li></ul><p><strong>Level of Decision Autonomy</strong></p><ul><li><strong>Hierarchical (Low):</strong> Agents act as focused specialists. They execute tasks only when instructed and operate strictly within the scope defined by the supervisor.</li><li><strong>Network (High):</strong> Agents are independent peers. Each agent determines when its task is complete and triggers the next appropriate agent.</li><li><strong>Custom Workflow (Medium):</strong> Agents have freedom within clearly defined boundaries. For example, a technical agent determines the remediation steps, while a router controls whether that agent is invoked at all.</li></ul><p><strong>Task Trajectory Complexity</strong></p><ul><li><strong>Hierarchical (Medium):</strong> The path is centrally managed. A supervisor defines the plan and splits the work across agents, making it easy to manage multiple tasks in parallel. Individual tasks can be complex, but the overall flow stays clear, structured, and easy to debug.</li><li><strong>Network (Low):</strong> The path emerges naturally from agent conversations. There is no predefined plan, often moving one step at a time, which limits parallel execution. This makes the setup simple, but the sequence of actions can quickly become hard to follow or predict.</li><li><strong>Custom Workflow (High):</strong> The path is fully predefined. Each step, condition, and transition is explicitly designed. This requires more upfront work, but it gives you full visibility, precise control, potential parallelization and complete traceability of how decisions are made.</li></ul><p><strong>Modularity &amp; Reusability</strong></p><ul><li><strong>Hierarchical (High):</strong> Individual agents can be upgraded or replaced without impacting the rest of the system. A new agent can be swapped in without changing the supervisor logic.</li><li><strong>Network (Medium):</strong> The system is flexible. New agents can be added easily, as long as existing agents are aware of their role.</li><li><strong>Custom Workflow (Medium):</strong> Modularity is tied to the workflow graph. Adding new behavior usually requires updating routing logic and defining new paths.</li></ul><h4><strong>Framework Recommendations</strong></h4><p>Choosing a framework is about aligning its design philosophy with your architectural needs.</p><ul><li><strong>LangGraph:</strong> Particularly well-suited for<strong> all architectures</strong>. Its stateful graph model gives you fine-grained control over execution paths.</li><li><strong>Google ADK:</strong> It excels at large <strong>hierarchical</strong> systems with strong modularity and clear management layers.</li><li><strong>AutoGen:</strong> A reference framework for <strong>network</strong> and debate-based systems, where agents collaborate through open-ended conversations.</li><li><strong>CrewAI:</strong> Well suited for role-based <strong>hierarchical</strong> teams. It offers a good balance between structure and flexibility.</li><li><strong>LlamaIndex: </strong>Can support <strong>all three architectures</strong>, but with varying levels of effort. It is easy to use for network-style systems, requires more setup for hierarchical designs, and involves the most complexity when implementing fully custom workflows.</li><li><strong>OpenAI Agents SDK:</strong> A strong choice for simple<strong> hierarchical</strong> systems.</li></ul><p>Other elements, such as the overall enterprise technology landscape and the comfort level of the development team, will also influence the choice of framework.</p><h3><strong>Conclusion: Architecture First, Framework Second</strong></h3><p>Multi-agent systems are not about chasing the latest framework or recreating human organizations for the sake of it. They are about <strong>making complexity manageable</strong>. The biggest mistake teams make today is jumping straight to a toolkit without first deciding how agents should collaborate.</p><p>None of the three architectures described in this article are “better” in absolute terms; each one is optimized for a different trade-off between control, flexibility, and complexity. Frameworks like LangGraph, AutoGen, CrewAI, Google ADK, or the OpenAI Agents SDK simply operationalize these choices. Each framework comes with its own strengths and limitations, depending on the architecture you choose.</p><p>If there is one key takeaway from this article, it’s this: <strong>Architecture is the strategic decision; frameworks are tactical enablers.</strong></p><p>This article is illustrated with a working implementation available on the <a href="https://gallery.dataiku.com/projects/EX_ADV_AGENTS/"><strong>Dataiku Public Gallery</strong></a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0c4cce51be50" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-from-the-trenches/multi-agent-systems-demystified-how-to-pick-the-right-architecture-and-framework-for-your-task-0c4cce51be50">Multi-Agent Systems Demystified: How to Pick the Right Architecture and Framework for Your Task</a> was originally published in <a href="https://medium.com/data-from-the-trenches">data from the trenches</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I Trust My AI Agent, Do You Trust Yours?]]></title>
            <link>https://medium.com/data-from-the-trenches/i-trust-my-ai-agent-do-you-trust-yours-11589ebbd6e9?source=rss----853867ec3a23---4</link>
            <guid isPermaLink="false">https://medium.com/p/11589ebbd6e9</guid>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[retrieval-augmented-gen]]></category>
            <category><![CDATA[agentic-rag]]></category>
            <dc:creator><![CDATA[Lucas Rousselet]]></dc:creator>
            <pubDate>Mon, 08 Dec 2025 14:41:12 GMT</pubDate>
            <atom:updated>2025-12-08T14:41:10.936Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="red circle glowing. Source: The MIT Press Reader." src="https://cdn-images-1.medium.com/max/1000/1*NuBXoLi6btm7OzPyW2WwXQ.jpeg" /><figcaption>Source: The MIT Press Reader.</figcaption></figure><h4>The Future of AI Is About Empowering Agents With the Right Tools for the Job</h4><p>It all started with a business problem so painful that it has haunted office workers for decades: responding to Requests for Proposal (RFPs) and Requests for Information (RFIs). These massive documents are a gauntlet of <strong>complex, repetitive, and interconnected questions</strong>.</p><p>A single question might require you to dig up info from three different internal documents, and the question on page 20 is probably a follow-up to one you answered back on page five. Working on this problem using an <strong>agentic RAG framework</strong>, I stumbled upon some hard-won lessons and insights that I believe can apply to a whole lot of RAG systems out there.</p><h3>What Exactly Makes This Task Difficult?</h3><p>Automating RFP and RFI completion means that your solution can handle these <strong>two main challenges</strong>:</p><ul><li>First, questions may require finding and combining information from<strong> multiple, separate knowledge sources</strong> to form a single answer. But just that would be playing on easy mode! What’s more, each retrieval often <strong>depends on previous parts of the answer,</strong> breaking any hope for parallel processing. This process of performing a series of intricate reasoning “hops” between documents to synthesize a complete response from scattered evidence is what’s known as a <strong>Multi-Hop</strong> challenge.</li><li>Second, a later question might be a <strong>direct follow-up to a much earlier answer</strong>. This makes it necessary for the agent to maintain a conversational “thread” to handle the <strong>dependencies between questions</strong>, and breaks <strong>question answering parallelism</strong>. It is referred to as Multi-Turn questions (as this feed can be seen as a conversation between a user asking questions and an assistant answering, each speaking in turns)</li></ul><figure><img alt="Typical instance of multi-hop question: The agent must first find the information about a GDPR solution in one data source, before searching for the date of last internal audit on it, very likely on another source." src="https://cdn-images-1.medium.com/max/1024/1*-OVW06YS9YReezE84v8dpg.png" /><figcaption>Typical instance of multi-hop question: The agent must first find the information about a GDPR solution in one data source, before searching for the date of last internal audit on it, very likely on another source.</figcaption></figure><p>Now, naive RAGs (1 retrieval + 1 generation) obviously cannot handle it, because their rigid, single-pass design lacks the necessary dynamic reasoning and memory capabilities. So, how can we do this?</p><h3>Assembly Line vs. Master Chef: A Tale of Two AIs</h3><p>When you build an <strong>advanced RAG system</strong>, you’re faced with a fundamental choice in its design philosophy, to define how it will reason and interact with data. This choice boils down to <strong>two competing paradigms</strong>: <strong>workflow vs. agentic.</strong></p><h4>1. Workflow: The Assembly Line</h4><p>Think of this as the classic, industrial approach. The system is a <strong>rigid assembly line with a fixed, hard-coded sequence of steps</strong>,<strong> functioning as a predefined system</strong>. The AI is a highly-skilled worker on this line, performing its specific task perfectly, but it has no say in the overall process. The path is always the same, for instance: first, rewrite the query; second, retrieve the documents; third, re-rank them; fourth, generate the answer. No deviations allowed.</p><p>This is the “System 1” of AI: controllable, tunable, interpretable, but completely inflexible. In the present case, you would typically include:</p><ul><li><strong>A question decomposer</strong> that breaks the complex initial query into a fixed sequence of simpler sub-questions.</li><li><strong>A query builder </strong>that rephrases each sub-question, often by integrating answers from previous turns to handle the multi-turn context.</li><li><strong>A retriever called sequentially</strong>, that execute in a predetermined order to fetch the necessary information for each sub-question.</li><li><strong>One or several evaluators</strong>, at various stages, to check that the model’s on track.</li><li><strong>A memory handler</strong>, so that you save past answers, to be used in later questions.</li><li><strong>A synthesizer, </strong>a<strong> </strong>final module that takes all the separately retrieved pieces of information and combines them into a single, coherent answer.</li></ul><p>And these are just the required blocks, nothing fancy yet…</p><h4>2. Agentic System: The Master Chef</h4><p>This is where things get exciting. In the <strong>agentic paradigm</strong>, the AI is no longer a worker on the line; it’s the master chef running the kitchen.</p><p>The agent has complete autonomy. It looks at the user’s request, assesses the available information and tools, and dynamically creates its own recipe for solving the problem. It decides <strong><em>if</em> it needs a tool, <em>which</em> tool to use from its toolkit, and in <em>what order</em></strong>. It might start with a web search, then decide based on the results that it needs to query an internal database, all while “thinking” and adapting its plan on the fly.</p><p>This is the “System 2” of AI: <strong>deliberate, flexible, and powerful</strong> enough to tackle the messy, unpredictable problems of the real world. However, you must <strong>trust the AI ability to effectively handle those tools and reason efficiently</strong>. Expecting a master chef but getting a chaotic kitchen hand? That’s bad news for your restaurant…</p><p>So, which paradigm should you use? Luckily for you, I tested them myself, and here are the results.</p><h3>Cages vs. Playgrounds: Choosing How Your AI Thinks</h3><p>We have our <strong>two competing philosophies</strong>. Here’s what I did: I tested several instances of each kind, including the modular frameworks in the predefined setting, and different ReAct modules for the agentic paradigm. More specifically, I replicated the <strong>ComposeRAG</strong> architecture from <a href="https://arxiv.org/abs/2506.00232">this recent paper</a>, an approach noted for its strong performance in business settings on this kind of Multi-Hop challenges, and then benchmarked it against several relevant datasets.</p><p>Then, I compared it with a ReAct agent equipped with a tool to access the same database. I won’t delve into anymore details, but rather stick to results and general conclusions that I think are safe to draw at this point.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TCVMdfxqdqTuCnyAc0Do4w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Yu35XLEHW-7AqpmKJlGdhg.gif" /><figcaption>Left: Original figure from the <a href="https://arxiv.org/abs/2506.00232">ComposeRAG</a> paper. Right: Generic ReAct architecture from <br><a href="https://blog.dailydoseofds.com/p/intro-to-react-reasoning-and-action">Daily Dose of Data Science</a></figcaption></figure><h4>The Assembly Line on Trial</h4><p>As you’ve probably already guessed, I am not a big fan of this paradigm. The workflow approach is fundamentally rooted in a <strong>mistrust of the model’s own capabilities</strong>. It operates like a micromanager, forcing the AI down a strict, unchangeable path because it doesn’t trust it to figure out the best steps on its own. This philosophy leads to these critical flaws:</p><ul><li><strong>It is inherently inefficient.</strong> This paradigm forces every problem, regardless of its complexity, through the same rigid, multi-step pipeline. This “one-size-fits-all” approach prevents the model from adapting its effort, often wasting significant computational resources on simple tasks, and lacking budget for the hardest ones. Sure, you can try to multiply the pipes, discriminating between cases, but then…</li><li><strong>It requires significant upfront engineering.</strong> Designing a robust, fixed pipeline involves meticulously planning a complex web of inter-module dependencies to prevent errors and optimize cooperation. Thus, complexity (hence time) grows exponentially with the number of blocks. Building this sophisticated support structure to guide the model is a time-consuming process that may become obsolete as models evolve.</li><li><strong>It cannot adapt easily through time.</strong> Like an assembly line built for one specific product, it lacks the flexibility to adapt to small changes in the goal or nature of the task over time. You have the right to mistrust AI’s ability to reason, but then you ought to do it yourself, and anticipate each and every corner case that could pop up. Otherwise, you may be forcing your system to put a square peg in a round hole. And if you have been engineering solutions for some time, you know that unexpected cases are bound to happen. Even worse, a single unexpected event can cause the entire pipeline to fail but take some time to debug, retracing all generations, from all modules…</li></ul><h4>The Agentic Approach Takes the Stage</h4><p>This approach is the exact opposite. It’s built on trusting the model’s intelligence and giving it the autonomy to be a maverick. Give the agent its goals, the tools it can use, and let him handle the rest.</p><ul><li><strong>It simplifies development and debugging.</strong> Instead of engineering a complex, rigid pipeline with numerous inter-dependencies, the developer’s role shifts to providing the AI with a clear set of tools. The agent itself handles the complex task of planning and orchestration, which can make the underlying code far simpler to write and maintain.</li><li><strong>It leverages the model’s superior decision-making. </strong>AI (with all due respect) is already smarter than you when it comes to tool handling, which often leads to more effective and efficient solutions than a human can predict and hard-code, as the model can adapt its strategy in real-time.</li><li><strong>It’s a future-proof bet.</strong> Building agentic systems aligns with the primary focus of major AI labs, as the latest and future models are being explicitly trained for autonomous tool use.</li></ul><h4>A Few Conclusions</h4><p>Ultimately, this choice between the Micromanager and the Maverick is the very heart of what I call the <strong>Crutch Dilemma</strong>. A crutch is an indispensable tool for someone with a broken leg, providing the necessary support to overcome a <strong>temporary weakness. </strong>However, once the leg has healed and recovered its strength, continuing to rely on it becomes counterproductive. It actively hinders natural movement and slows the person down.</p><p>Similarly, many of the complex, engineered solutions we build to guide LLMs are essentially <strong>“cognitive crutches”</strong>. They are sophisticated systems designed to compensate for the specific, temporary weaknesses of a particular model generation.</p><p>The dilemma arises because these models are “healing” at an astonishing rate. The carefully designed crutch that helps today’s model may become a <strong>liability</strong> just a few months later. This creates a difficult choice: Is it worth investing significant effort to build a complex support structure for a problem that a simple model update might solve organically in the near future?</p><figure><img alt="Yes, that is ridiculous. But are you sure that you aren’t forcing your agent to run with crutches? Source:heRandomAdventureMan Youtube channel." src="https://cdn-images-1.medium.com/max/360/1*yAaeJAbHxEkB0Rj-Gu5lmw.gif" /><figcaption>Yes, that is ridiculous. But are you sure that you aren’t forcing your agent to run with crutches? Source:<em>heRandomAdventureMan Youtube channel.</em></figcaption></figure><p>Back to our example: I was working on these frameworks based on <strong>OpenAI’s o4-mini and o3</strong> when<strong> gpt-5</strong> was released in August. So this was the perfect test to evaluate how a more powerful model would perform. Guess what: When placed into a workflow, the new model’s performance stagnated and sometimes even degraded, whereas the agentic framework allowed gpt-5 to flourish, showing massive performance gains on top of its already strong baseline.</p><p>So, when it comes to the future of AI, will you bet on control or autonomy?</p><h3>The Elephant in the Room: It’s Always Been About the Data</h3><p>We’ve spent a lot of time looking at the AI’s “brain,” but lurking behind every success and failure is the real kingmaker of any RAG system: the data itself!</p><h4>The True Bottleneck</h4><p>Let’s be clear: In the world of RAG, the bottleneck has almost always been the data. The most common reason these systems fail is not that the AI misunderstands the information it’s given, but that the retrieval system failed to provide the right information in the first place. The principle of <strong>“garbage in, garbage out”</strong> is paramount. If your data handling is flawed, even the most brilliant AI agent is doomed to fail. So was it worth discussing on reasoning frameworks if the bottleneck is elsewhere? Well, everything’s linked.</p><h4>A New Paradigm: From Retrieval to Navigation</h4><p>How your knowledge base is <strong>structured</strong> and <strong>accessed</strong> is the most critical question. The traditional approach is to take structured documents and flatten them into a collection of unstructured text chunks. This is a massive problem because it <strong>severs the inherent relationships between sections</strong>, destroying the document’s original, logical structure.</p><p>Think about how a human researcher works. They don’t search through a million disconnected sentences. They navigate hierarchically: skimming a table of contents, identifying relevant chapters, scanning section headings, and only <em>then</em> reading a specific passage. This navigational paradigm proposes giving AI agents a similar set of tools to traverse the hierarchical structure of a knowledge base.</p><p>This is where everything comes together. This advanced, navigational approach to data <strong>only works symbiotically with an agentic system</strong>. A <strong>workflow</strong>, simply cannot perform this kind of dynamic exploration natively. It can’t decide to “skim a table of contents” and then “read a specific section” based on what it finds, unless it relies on numerous, complex and brittle modules that will not fit well in this setting.</p><p>An <strong>agentic system</strong>, however, is perfectly suited for this, because it was <strong>created for this</strong>, based on an LLM <strong>trained to do so</strong>. Its ability to autonomously choose which tool to use and what to do next is exactly what’s needed to intelligently navigate a complex document structure, just like a human would.</p><p>The future of data handling doesn’t just prefer the agentic approach; it demands it.</p><h3>Your Takeaway: Stop Building Pipelines, Start Empowering Agents</h3><p>The future of advanced, useful AI lies not in forcing models into rigid pipelines, but in empowering them with the autonomy, and ad-hoc tools to navigate problems on their own terms.</p><p>So if you’re building a system to tackle complex Q&amp;A, the recommendations are simple:</p><ol><li><strong>Structure your data for an AI system.</strong> Make your knowledge base easy for an agent to interact with, ideally through a well-documented API.</li><li><strong>Give it the right tools.</strong> Provide the agent with simple, clear functions to access that data.</li></ol><p>In the age of AI, the ones who truly understand the technology are the ones who will lead the race. And that means understanding that the best systems don’t constrain AI — they set it free.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=11589ebbd6e9" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-from-the-trenches/i-trust-my-ai-agent-do-you-trust-yours-11589ebbd6e9">I Trust My AI Agent, Do You Trust Yours?</a> was originally published in <a href="https://medium.com/data-from-the-trenches">data from the trenches</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How Can You Identify an Agentic AI Use Case?]]></title>
            <link>https://medium.com/data-from-the-trenches/how-can-you-identify-an-agentic-ai-use-case-b95b3fa45600?source=rss----853867ec3a23---4</link>
            <guid isPermaLink="false">https://medium.com/p/b95b3fa45600</guid>
            <category><![CDATA[ai-agent-use-cases]]></category>
            <category><![CDATA[agentic-ai-framework]]></category>
            <category><![CDATA[agentic-system]]></category>
            <category><![CDATA[ai-agents-in-action]]></category>
            <dc:creator><![CDATA[Pierre Petrella]]></dc:creator>
            <pubDate>Mon, 17 Nov 2025 16:34:38 GMT</pubDate>
            <atom:updated>2025-11-19T15:22:50.262Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YcNprlKTJX4dH0DU7KYs2g.png" /></figure><p>It could be the first or the tenth time you’ve heard the word “agent” today but, either way, you’ve made it to this article. If you are looking to get more <em>clarity</em> on all this “agent talk,” then you are in the right place. We will start by <em>demystifying</em> the concept of agents so we can then understand <strong>where and how they can be used</strong> to generate <strong>quantifiable</strong> <strong>value</strong>.</p><p>Given that 80% of companies have at least one division using AI <a href="https://www.mckinsey.com/capabilities/quantumblack/our-insights/seizing-the-agentic-ai-advantage#/">per McKinsey</a>, it is likely that you have or have been asked about the questions listed above. You probably also noticed that there isn’t a real consensus around the topic and answers may vary based on people’s backgrounds, industry, or what new agent article they read that week.</p><p>Without further ado, let’s dive in.</p><h3>What Is an Agent?</h3><p>An agent is one of the possible ways of leveraging the <strong>raw power of generative AI (GenAI), </strong>specifically large language models (LLMs) commoditized by the likes of OpenAI, Anthropic, Google, etc.</p><p>Typical agent use cases<strong> generate value by automating tasks that have traditionally resisted automation</strong> such as solving support tickets, resolving a policy claim, building a marketing campaign, or even answering challenging questions about your data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G3efxUPoCkJsnXGe5yj7_A.png" /></figure><blockquote>A GenAI application qualifies as an agent if it is LLM-powered, exhibits some degree of <strong>reasoning</strong> and, when triggered, can complete a defined <strong>task</strong> using a specific set of <strong>tools</strong>.</blockquote><p>Let’s dive into the three core concepts of an agent: task, tools, and reasoning.</p><p>Any <strong>task</strong> has a beginning and an end, so does an agent’s execution. All agent executions will start with an input trigger such as a chat message, image, email, alert, or signal that will inform the agent of the task at hand. All agent executions will at some point end with a final answer signaling the end of the task.</p><p><strong>Tools</strong> are what separates agents from LLMs. LLMs are great for reasoning, but their knowledge is limited to the data that they were trained on. Tools give LLMs the option to interact with the outside world elements like the internet, internal corporate data, or email servers. Tools can be categorized in three different buckets:</p><ol><li><strong>Context fetchers (Read) </strong>Ex: Internet search, vector database search, dataset query/lookup</li><li><strong>Persisting actions (Write)</strong> Ex: Append to dataset, send email, run procedure</li><li><strong>Orchestration (Delegate)</strong> Ex: LLM, subagent, Set of subagents, human</li></ol><p>It is key to remember these categories as they will be needed for the agent identification framework in the following section.</p><p>And finally,<strong> reasoning</strong>, a crucial component of an agent. It gives the agent the ability to dynamically and iteratively choose the actions/tools that need to be taken to achieve the task at hand. If it was not for this reasoning, the task could not be fully automated and would require some level of human judgment or intervention to be completed.</p><p>All in all, if you have a GenAI application that has a clear <strong>task</strong> and that requires <strong>reasoning </strong>to efficiently use <strong>tools</strong> to solve a task … then you might just be looking at an agent!</p><h3>Agents vs. Workflows</h3><p>In the world of<strong> agent systems</strong>, there is another popular type of application commonly known as <strong>workflows</strong>. Workflows are any predefined acyclical series of steps (ex; Do A, do B, and if A + B &gt;50, do C).</p><p>A GenAI workflow can be used for:</p><ul><li>Automating the application of sequential business rules.</li><li>Applying business logic to the output of an LLM call</li><li>Or even chaining a series of LLM calls.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4Qo_Eh3z1-VhcGsXBz7hRA.png" /></figure><p>Workflows, albeit very valuable GenAI applications, are not in the scope of this article but still deserve a mention as they are intimately connected to agents. As a matter of fact, agents can use workflows as part of their execution and workflows can run an agent as part of their execution.</p><p>Now that we are comfortable with agents, their three concepts, what they are, and what they aren’t, it is time to dive into the deep end and learn <strong>how to identify agent use cases in the wild</strong>!</p><h3>Do Agents Apply to My Role? To My Organization?</h3><p>To start off this exercise, you will need to first build up a list of as many processes/tasks that you, your team, the teams you work with, and the department and/or the company as a whole have. Don’t worry, you do not need to build an exhaustive list!</p><p>To help build the list, here are a few prompting questions that can help. Think of tasks that:</p><ul><li>Would take less time to validate than to do it from scratch.</li><li>Have <strong>resisted being automated </strong>due to the unstructured nature of the data (mainly text).</li><li>Are tasks <strong>repeated</strong> on a daily, weekly, or monthly basis and could be <strong>automated</strong> given a<strong> bit of common sense.</strong></li><li>Take a long time to complete given <strong>the space distribution of data owned </strong>by multiple people from various teams.</li><li>Rely heavily on<strong> subject matter expert(s)</strong> in your organization that can act as <strong>process bottlenecks</strong> given their limited availability.</li></ul><p>Technically speaking, agents, given the right set of tools, can be delegated any task that can be done by only interacting with a computer, so you can be ambitious on the process/tasks to consider in this list.</p><p>Once you have a healthy list of processes/tasks, it is time to identify the ones that could be delegated to an agent. For this, we want to single out processes that involve a finite <strong>task</strong>, <strong>reasoning </strong>for decision making, and that require interacting with external systems through<strong> tools</strong> (yes, these are the three core agent components we detailed in the previous section).</p><p>Let’s get started!</p><p>Counterintuitively, the first thing you will have to do is to completely forget that we are talking about agents and instead focus on something much more familiar … coworkers.</p><p>Meet Tim. Tim is a new intern who just joined your organization. Tim is smart and well-educated, but he does not know anything about your organization, its core business, its systems, or its processes. Tim also does not take initiatives when the context is too ambiguous. For each of the previously identified tasks, <strong>how would you explain the process/task to Tim?</strong></p><p>Given the explanation you gave Tim, can he solve the task by following a predetermined set of steps (workflow) or <strong>will Tim require reasoning</strong> to choose the right company resources and tooling to accomplish the task? If the latter, the task you gave Tim is a good candidate use case to be delegated to an agent, but we are not done yet!</p><p>To confirm its agentic nature, the next step is to run this use case using the following <em>Agent Identification Framework.</em></p><h3>Agent Use Case Identification Framework</h3><p>This Agent Identification Framework aims to qualify and define an agentic use case. After applying this framework, you will have clearly identified the following five characteristics that fully define an agent.</p><ol><li>The <strong>Input/Trigger</strong> of the agent (what is the agent’s starting point).</li><li>The <strong>Objective</strong> of the agent (what should come out of the agent).</li><li>The <strong>Scope</strong> of the agent (what are/aren’t its responsibilities).</li><li>The exhaustive list of <strong>Tools </strong>the agent needs to use to achieve its goal.</li><li>The <strong>Playbook/Guidelines</strong> that the agent should follow.</li></ol><p>This framework is a two-step process:</p><ul><li><strong>Step I</strong>: Identify and document a set of representative examples of agent runs.</li><li><strong>Step II</strong>: We extract the five agent characteristics listed above.</li></ul><h3>Step I: Identify &amp; Document Representative Examples</h3><p>To start with the exercise, we need to go back to Tim and identify <strong>a set of representative end-to-end examples</strong> of the task (typically three to five) that he would need to accomplish. For each example, we want to identify the step-by-step process that Tim would go through to successfully complete the task.</p><p>Each example description should contain the following three elements: input, output, and process.</p><h4>Input (Initial Instructions)</h4><p>Imagine you’ll be on vacation for a week and you need to provide Tim with an email that has enough details to start on a given task without needing further assistance from you.</p><h4>Output (Final expected state)</h4><p>Describe the output state of the completed task including all the actions performed by Tim and the final output answer. Think of it again as an email that Tim would need to write back to you. It should contain enough information for you, coming back from your two-week holiday to validate that the task has been done, and done well.</p><h4>Process (Step-by-Step Actions to Solve the Task)</h4><p>List the set of <em>Thought, Action, &amp; Observations</em> that Tim needs to go through to complete the task, from the provided input all the way to the expected output state. Use the following guide to properly document each Thought, Action, and Result.</p><p><strong>Thought</strong>: Given the current state (everything done so far), what would Tim’s next best action be? Specify the reasoning behind it. For example:</p><ul><li>I need to check my unread emails to see if anyone has contacted me.</li><li>I need to search the web as I need public information on the government’s website.</li></ul><p><strong>Action</strong>: Explicitly define the next action needed including any specifications</p><ul><li>Open inbox and filter for <strong>unread</strong> emails in the <strong>last 30 days.</strong></li><li>Call the Google search engine with the query “<strong>Top 5 enterprise agent building platforms.</strong>”</li></ul><p><strong>Result</strong>: Describe the outcome of the action. This is the new information that Tim has to decide what the best next step is.</p><p>The final action of any task is to<em> “end task”</em> and return a final output message.</p><h4>Sales Analysis Agent Example</h4><p>Business context and objective: Regional sales leaders want answers to their elaborate questions that should rely on data scattered across multiple internal information sources (SharePoint and Snowflake).</p><p>Example Case #1</p><p><strong>Input</strong>: (Text) What are the top five revenue-generating customers in the Americas region over the last three years?</p><p><strong>Output</strong>: (Text) The top five customers in the Americas over the last three years are X, Y, Z, A, &amp; B, in that order.</p><p><strong>Process</strong></p><p><em>Step 1:</em></p><ul><li><strong>Thought</strong>: The request requires me to leverage data at my disposal. I first need to list all the available tables and their schema descriptions to isolate the relevant tables.</li><li><strong>Action</strong>: List accessible tables that can be leveraged from the “sales data schema” database.</li><li><strong>Result</strong>: List of all sales tables and their schema’s metadata.</li></ul><p><em>Step 2:</em></p><ul><li><strong>Thought</strong>: From the available schemas, the table called product_sales in Snowflake I will need to leverage the customer_id, year, and amount columns to answer the question, given we are in 2025.</li><li><strong>Action</strong>: Generate and run SQL query with input “Filter the product_sales for the region Americas and transaction between 2023 and 2025, group data by customer_id, and sum the revenue. Keep only the top five customer_id.”</li><li><strong>Result</strong>: Resulting summary table listing the five customers.</li></ul><p><em>Step 3:</em></p><ul><li><strong>Thought</strong>: I know the answer to the user’s question, I am ready to answer.</li><li><strong>Action</strong>: End task.</li><li><strong>Result</strong>: Answer the question with the retrieved answer.</li></ul><p>Example Case #2</p><p><strong>Input</strong>: (Text) Hello, how are you?</p><p><strong>Output</strong>: (Text) I am good, thank you, I am your AI Sales Assistant, is there anything I can help you with?</p><p><strong>Process</strong></p><p><em>Step 1:</em></p><ul><li><strong>Thought</strong>: The user query does not require any internal knowledge. I can reply directly and propose to be helpful.</li><li><strong>Action</strong>: End task.</li><li><strong>Result</strong>: Answer with generic helpful message.</li></ul><p>Once enough examples have been provided to give a representative sample of the types of tasks the agent might have to tackle, it is time to wrap up the exercise with Step II!</p><h3>Step II: Extract the 5 Agent Characteristics</h3><p>Lucky for us, the <strong>input/trigger</strong>, <strong>objective</strong> (output state), and the <strong>scope</strong> have already been documented for us through the examples above.</p><p>The <strong>input/trigger</strong> can be inferred from all the example inputs documented above. Here the agent is <em>triggered by the regional sales leaders submitting a question about their sales data</em>.</p><p>The <strong>objective</strong> will be the combination of persistent actions (write tools) and the agent’s response for all inputs. Here, the agent needs to <em>leverage available sales data to answer all questions from the sales regional leader.</em></p><p>The <strong>scope</strong> of the agent is <em>the set of tasks of the same nature as the ones documented above</em>. In the case you identified edge-case tasks that were not part of the examples above, feel free to update Step I accordingly.</p><p>The remaining two elements to extract are the <strong>tools</strong> and agent’s <strong>playbook/guide</strong>.</p><p>To extract the <strong>tools</strong>, go through all the <strong>Action </strong>elements in the examples and classify each as:</p><ol><li>No tools needed: All the information is already known, nothing to do.</li><li>Tool is needed: A<strong>dd/update</strong> the tool to the list, including:<br>&gt; Tool <strong>name</strong> (short and explicit)<br>&gt; Tool <strong>description</strong> (when to use the tool)<br>&gt; Tool <strong>input parameters</strong> (its signature)<br>&gt; Tool <strong>output</strong> (content and format)<br>&gt; Tool <strong>category</strong> (Read, Write, or Delegate)<br><em>Note: Make sure to consolidate tools together, as your agent probably used the same tool multiple times.</em></li><li>Tool needs clarification: An action is needed, but we don’t have enough information to define the five descriptors of a single tool.<br>&gt; This means that the action is too complex and should be split into different tools or delegated all together to a subagent.</li></ol><p>In the examples above, the final tools would be:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mKpvOTHdf7OHxOoofZ0o4Q.png" /></figure><p>You now have an exhaustive list of tools (and possibly subagents) waiting to be built!</p><p>To define the <strong>playbook/guidelines</strong> of the agent, also known as the agent prompt, you will have to go through all of the <strong>Thought</strong> sections of your examples. For each thought, take note of all the logic based on external business knowledge and not inferred from neither the previous tool call results nor from common knowledge (i.e., internal business process logic, special naming conventions, specific personality, acronyms, etc).</p><p>You now have all the context and guidance needed by the agent ahead of each task ready to be added to the agent prompt!</p><p>If you’ve made it this far, congrats! You now know how to find and narrow down potential agents, rank them by their business value, and run them through the Identification framework on your own.</p><h3>Conclusion</h3><p>We learned what an agent was and what differentiated it from its counterpart agentic system: workflows. We learned how to build a shortlist of potential agent use cases and how to leverage the <em>Agent Identification Framework</em> to concretely define the scope, roles, and responsibilities of these agents.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b95b3fa45600" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-from-the-trenches/how-can-you-identify-an-agentic-ai-use-case-b95b3fa45600">How Can You Identify an Agentic AI Use Case?</a> was originally published in <a href="https://medium.com/data-from-the-trenches">data from the trenches</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AI Hit a Wall and the Solution Was to Teach It to Think Longer]]></title>
            <link>https://medium.com/data-from-the-trenches/ai-hit-a-wall-and-the-solution-was-to-teach-it-to-think-longer-5bccf9c08470?source=rss----853867ec3a23---4</link>
            <guid isPermaLink="false">https://medium.com/p/5bccf9c08470</guid>
            <category><![CDATA[test-time-compute]]></category>
            <category><![CDATA[scaling-ai]]></category>
            <category><![CDATA[generative-ai]]></category>
            <category><![CDATA[llm]]></category>
            <dc:creator><![CDATA[Lucas Rousselet]]></dc:creator>
            <pubDate>Thu, 30 Oct 2025 15:22:34 GMT</pubDate>
            <atom:updated>2025-10-30T15:22:33.318Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Rodin museum sculpture" src="https://cdn-images-1.medium.com/max/652/1*dSP0vnY9nr3zuom5KggrdA.jpeg" /><figcaption>Source: Rodin Museum</figcaption></figure><h4>A Guide to Test-Time Compute Scaling to Unlock Smarter, More Accurate AI Without Breaking the Bank on Retraining</h4><p>For decades, the playbook in AI has been simple: Bigger is better. Got a problem? Build a bigger model. Need more accuracy? Throw more data and a few million dollars at it, retrain through backpropagation, and there you are. This relentless scaling gave us incredible tools, but we’ve started to hit a massive, expensive, and frustrating “Scaling Wall.”</p><p>Training the next generation of trillion-parameter models now costs more than a Hollywood blockbuster (we’re talking &gt;$100 million), requires more high-quality data than we can find on the whole internet, and is often plagued by instability.</p><figure><img alt="Training through backpropagation has not fundamentally changed since LeCun in the 1990s, only models have risen to trillions of parameters instead of a few thousand. Source:TechNews.tw" src="https://cdn-images-1.medium.com/max/635/1*Nf4unUrNgDRHqih-zC_IhQ.gif" /><figcaption><em>Training through backpropagation has not fundamentally changed since LeCun in the 1990s, only models have risen to trillions of parameters instead of a few thousand. Source:TechNews.tw</em></figcaption></figure><p>Post-training helped for some time (you know, fine-tuning the model so that it aligns with our goals, our way of thinking, etc.), but eventually hit a wall as well (see figure below). So, researchers and tech firms thought, “What if, instead of building a bigger brain, we could just teach the brains we have to <em>think harder</em>?”</p><p>This is the promise of<strong> Test-Time Compute (TTC)</strong>, the next frontier in AI scaling that blossomed in 2025. Get ready to understand how it works (and whether you should use it or not).</p><h3>What on Earth Is Test-Time Compute?</h3><p>Let’s break it down with a simple analogy: Imagine that your AI model is a brilliant student.</p><ul><li><strong>Training Time</strong> is their entire education — years of learning, reading books, and taking exams. This is where the model learns its skills. It’s incredibly expensive and time-consuming.</li><li><strong>Test-Time</strong> (or “inference”) is … test time! When you give that student a single, tough question, and he/she must now use their knowledge to understand the question, its structure and underlying ins and outs, and answer it in a comprehensive way.</li></ul><p>The old way was to just hope the student’s education was good enough to blurt out the right answer instantly.</p><p>A (hopefully) better way is giving that student a piece of scratch paper and telling them, “Hey, take your time. Think about this step by step. Write down your thoughts before you give me the final answer”. This is one possible technique based on TTC scaling, usually called <em>Chain-of-Thoughts (CoT)</em>, but there are others. We’ll delve into the details in a minute.</p><p>Before this, let’s give <strong>TTC scaling</strong> a proper definition, breaking it down term-by-term:</p><ul><li><strong>Test-Time</strong>: It’s the phase where training is done, and weights of the model are frozen.</li><li><strong>Compute</strong>: The amount of computing power needed, usually expressed in FLOPs (floating-point operations per second). Remember: LLMs are basically huge neural networks, composed of thousands of matrices undergoing basic operations (multiplication, addition, etc.). So, in the context of LLMs at test-time, compute is directly related to the number of matrix calculations you need. As each new generated token implies a pass in the model, longer generation (more tokens) means more compute.</li><li><strong>Scaling</strong>: As you’d imagine, tech firms do not want to spoil money on supplementary compute if it does not lead to increased performance. So, the goal is to find techniques that let us continue riding these nice scaling laws (see figure below).</li></ul><p>So, <strong>TTC scaling</strong> is just this: <strong>using more compute at inference to boost accuracy.</strong></p><figure><img alt="We’re moving from just pre-training to post-training and now the new frontier: Test-Time Scaling, or “Long Thinking.” Source: Nvidia Blog — How Scaling Laws Drive Smarter, More Powerful Al." src="https://cdn-images-1.medium.com/max/1024/1*vdcCOFLtVujtrK9HDl0HEQ.jpeg" /><figcaption><em>We’re moving from just pre-training to post-training and now the new frontier: Test-Time Scaling, or “Long Thinking.” Source: Nvidia Blog — How Scaling Laws Drive Smarter, More Powerful Al.</em></figcaption></figure><p>So, does it work? Short answer is … yes, and quite dramatically!</p><h3>The Verdict Is In: TTC Scaling Works</h3><p>The concept has been discussed for several years, initially in the context of board games and AlphaZero algorithms. However, it gained significant traction in the LLM space following two key events in late 2024 and early 2025:</p><ul><li><strong>OpenAI’s o1</strong>: In September 2024, OpenAI’s release of o1 marked a major breakthrough for the reasoning paradigm.</li><li><strong>Deepseek’s R1</strong>: In January 2025, the open-sourcing of the Deepseek R1 model enabled wider community experimentation with these techniques.</li></ul><figure><img alt="OpenAI’s dramatic increase in accuracy in the ARC-AGI 1 benchmark, thanks to reasoning models. Source: Mohamed Louadi- From Genes to Artificial Intelligence: Redefining Human Evolution" src="https://cdn-images-1.medium.com/max/1024/1*DAv9zgHnk18h18_v5TBxbQ.jpeg" /><figcaption>OpenAI’s dramatic increase in accuracy in the ARC-AGI 1 benchmark, thanks to reasoning models. Source: <a href="https://www.researchgate.net/profile/Mohamed-Louadi-2?_tp=eyJjb250ZXh0Ijp7ImZpcnN0UGFnZSI6Il9kaXJlY3QiLCJwYWdlIjoiX2RpcmVjdCJ9fQ"><em>Mohamed Louadi</em></a><em>- </em><a href="https://www.researchgate.net/publication/389290241_From_Genes_to_Artificial_Intelligence_Redefining_Human_Evolution?_tp=eyJjb250ZXh0Ijp7ImZpcnN0UGFnZSI6Il9kaXJlY3QiLCJwYWdlIjoiX2RpcmVjdCJ9fQ"><em>From Genes to Artificial Intelligence: Redefining Human Evolution</em></a></figcaption></figure><p>For years, poor performance on the <strong>ARC-AGI benchmark</strong> — a test of abstract reasoning using visual puzzles, specifically designed to test raw reasoning abilities — fueled the argument that LLMs couldn’t truly “think.” The consistent failure of even advanced models like GPT-4 suggested they were merely sophisticated mimics incapable of genuine generalization.</p><p>This long-held belief was shattered by OpenAI’s <strong>“o1” and then “o3” models </strong>(see figure above). They achieved a sudden, massive jump in performance on ARC-AGI, directly challenging the perceived limits of AI reasoning and reigniting the debate about their potential for true intelligence. And guess what, the key change was the use of <strong>TTC scaling!</strong></p><p>These models also outperformed any previous ones in a series of very challenging benchmarks (competition-level maths, Ph.D.-level science questions, etc.). As a consequence, all major LLM providers propose reasoning models (we will see in a minute what they are).</p><p>Because they’ve proved so effective, we’ll now look at how these reasoning models have been trained.</p><h3>Learning to Reason</h3><p>Training an LLM to reason goes beyond simply showing it a massive library of text (which had basically been the training paradigm until then). The process is a deliberate, multi-stage effort to teach the model how to construct logical arguments and solve problems step by step.</p><p>At its core, the training relies on specialized datasets and sophisticated reward mechanisms.</p><ul><li><strong>Curated Datasets With Explicit Reasoning:</strong> The model isn’t just trained on the final answers to problems; it’s fine-tuned on high-quality, <strong>step-by-step annotated data</strong>. These datasets contain problems (in mathematics, logic, or code) paired with detailed, human-verified reasoning chains. This teaches the model the <em>structure</em> of a logical argument, not just the correlation between a question and its answer. For example, the GSM8K dataset, a popular benchmark, includes grade-school math problems with fully worked-out solutions.</li><li><strong>Process Supervision in Reinforcement Learning:</strong> Standard Reinforcement Learning from Human Feedback (RLHF) might only reward a model for getting the final answer correct (<strong>outcome supervision</strong>). This is risky, as the model could learn flawed logic that happens to work for some problems. Reasoning models, however, are often trained using <strong>process supervision</strong>. In this method, a human reviewer evaluates and rewards <em>each individual step</em> in the model’s generated reasoning chain. This is far more labor-intensive but ensures the model learns a robust and reliable reasoning process, penalizing logical fallacies even if the final answer is accidentally correct.</li><li><strong>Synthetic Data Generation and Self-Correction:</strong> To scale the creation of reasoning data, techniques like <strong>Self-Taught Reasoner (STaR)</strong> are employed. Here, an LLM is used to generate its own reasoning chains for a set of problems. If the final answer is correct, the generated chain is added back into the training data as a positive example. This creates a powerful self-improvement loop.</li><li><strong>Architectural and Algorithmic Enhancements:</strong> The training process is designed to support more complex inference-time algorithms. While a standard LLM generates text token-by-token in a linear fashion, reasoning models are trained to be amenable to more structured exploration. This enables techniques like <strong>Tree of Thoughts (ToT)</strong>, where the model can explore multiple parallel reasoning paths (branches of a tree), evaluate their potential, and backtrack from unpromising ones. This requires the model to be proficient at generating self-evaluations and scoring intermediate “thoughts.”</li></ul><p>These are the main building blocks when training a powerful “native” thinker: At inference, the model will spontaneously produce CoT detailing its reasoning path before generating a final answer.</p><p>But keep in mind that <strong>reasoning models are just one way</strong> to leverage <em>CoT, </em>a specific technique based on TTC scaling. The main principle is <strong>increasing the number of generated tokens at inference:</strong> There are <strong>multiple approaches</strong> to this, and some can even be combined. We will see now a taxonomy of the main techniques.</p><h3>The TTC Toolkit: How to Make Your AI “Think”</h3><p>TTC isn’t a single method; it’s a whole galaxy of clever techniques. Most of them fall into three main families, but keep in mind that this is not exhaustive.</p><h3>1. CoT: The “Show Your Work” Method</h3><p>This is the most popular TTC technique and also the way it emerged historically. Instead of letting the model jump straight to an answer, you prompt it to generate a “chain of thought” — a series of reasoning steps that lead to the solution.</p><p>It can be done by giving it examples in your prompt (in-context learning) or by simply adding a magic phrase like <em>“Let’s think step by step.”</em></p><figure><img alt="Historic way of nudging a model into thinking: providing examples of CoT in the prompt and hoping that the model will mimic this behavior (in-context learning)." src="https://cdn-images-1.medium.com/max/1024/1*LbRtATFSirAk4HfrI0WsOw.png" /><figcaption>Historic way of nudging a model into thinking: providing examples of CoT in the prompt and hoping that the model will mimic this behavior (in-context learning).</figcaption></figure><p>This is at the core of what we call reasoning models, including OpenAI’s “o” series: models that have been specially trained on thousands of CoT, to replicate this behavior. To the point that, at inference, they resort automatically to this drafting: They “think” natively before answering, without the need to nudge them.</p><figure><img alt="The other way for eliciting a thinking process, particularly effective on models that have already been trained on CoT (reasoning models)." src="https://cdn-images-1.medium.com/max/1024/1*LHatZR0XNJWyudvbYFWTFw.png" /><figcaption>The other way for eliciting a thinking process, particularly effective on models that have already been trained on CoT (reasoning models).</figcaption></figure><h3>2. Sampling: The “Phone a Friend … or 50” Method</h3><p>Why get one opinion when you can get many? Sampling techniques involve asking the model the same question multiple times to generate several different answers, which are then combined to find the best one.</p><ul><li><strong>Self-Consistency:</strong> You generate, say, 10 answers and pick the one that appears most often. It’s a simple majority vote that dramatically boosts reliability.</li><li><strong>Best-of-N:</strong> You generate <em>N</em> answers and then use a second, smaller model (a “verifier” or “reward model” trained specifically for this task) to score each one and pick the winner.</li><li><strong>Beam Search</strong>: A most advanced way to navigate into the tree of thoughts (where branches are feeds of successive thoughts) while only keeping most promising leads.</li></ul><figure><img alt="Self-consistency in a nutshell. All other sampling techniques are fundamentally refinements." src="https://cdn-images-1.medium.com/max/1024/1*v7UvlZCA2GHxcMbm1FITZw.png" /><figcaption>Self-consistency in a nutshell. All other sampling techniques are fundamentally refinements.</figcaption></figure><h3>3. Criticism &amp; Feedback: The “Draft, Revise, Repeat” Method</h3><p>This is my personal favorite. It turns the generation process into an <strong>iterative loop of refinement</strong>.</p><ol><li>The LLM generates an <strong>initial draft</strong> of the answer.</li><li>The LLM (or another model) <strong>critiques that draft</strong>, pointing out flaws or areas for improvement.</li><li>The LLM takes the feedback and <strong>generates a new, better version</strong>.</li></ol><p>You can loop this process until the answer is perfect, or you’ve hit your budget limit. A variation is using a powerful “teacher” LLM to guide a smaller, cheaper “student” model, correcting its reasoning only when it starts to go off track.</p><figure><img alt="Basic example of a feedback loop. Source: Madaan, A. et al. (2023). Self-Refine: Iterative Refinement with Self-Feedback." src="https://cdn-images-1.medium.com/max/470/1*X1r4IVQJeuoR94_cH6swFg.png" /><figcaption>Basic example of a feedback loop. Source: Madaan, A. et al. (2023).<strong> Self-Refine: Iterative Refinement with Self-Feedback</strong>.</figcaption></figure><p>Now let’s talk about when to use these techniques.</p><h3>To TTC or Not to TTC?</h3><p>TTC techniques are more suited for certain tasks and are unlikely to help for others. Choosing the right technique is all about <strong>diagnosing the type of difficulty you’re facing</strong>, as each family aims at solving a different kind of failure. Here are basic heuristics:</p><p><strong>CoT-based techniques</strong>, including the use of reasoning models, are adapted for tasks within the model’s known capabilities but with intricate and multiple steps. Here’s a simple rule of thumb I call <strong>The Human Expert Test</strong>.</p><p>Ask yourself: If I gave a human expert all the necessary information to perform a task, could they solve this task instantly, on the fly?</p><ul><li><strong>YES?</strong> (e.g., live translation, answering a simple factual question, writing a basic code snippet). Then TTC probably won’t help much. If your LLM is failing, the problem is likely somewhere else — it probably doesn’t have the right information.</li><li><strong>NO?</strong> (e.g., summarizing a messy 50-page document, solving a multi-step math problem, planning a complex project). If the expert needs to pause, think, and organize their thoughts, that’s a perfect use case for TTC! Letting the LLM “think” will allow it to break down the problem and deliver a much more accurate result.</li></ul><p>When the model is generally capable of a task but suffers from a lack of consistency, sometimes succeeding, other times hallucinating facts or getting stuck in a suboptimal reasoning path, Sampling techniques may help.</p><p>Finally, feedback can be used for novel tasks, likely falling outside the model’s training distribution. If it involves novel concepts, or requires adhering to very strict and unusual constraints, then checks and corrections can improve your results.</p><p>With all that said, a question remains: <strong>Should you DIY your own TTC techniques</strong>? The answer is unclear and depends greatly on your level of expertise, the task you are working on, the model you use, the budget you have, etc.</p><p>Keep in mind that the <strong>most powerful, mind-bending reasoning techniques are already being baked directly into the flagship models</strong> from the big leagues. They’re serving you five-star models, and they are getting better with every update.</p><p>So you could spend days or weeks of your time (and money) building a brilliant custom “thinking” engine for your AI, <strong>just in time for the next big model to be released</strong>, offering even better reasoning right out of the box and turning your masterpiece into a museum piece overnight. Furthermore, LLMs training processes are notoriously hard to predict, and the clever trick that boosts your accuracy today <strong>could become completely useless when the model’s mood shifts tomorrow</strong>.</p><p>Another point is that <strong>generation is not that often the real bottleneck</strong> in business use cases, not so much as data quality and availability. Most benchmarks build on very clean environments where models have access to every information they need, under the right format, in controlled settings, etc. This is not always (never?) the case in real life! So before any expensive experimentation,<strong> it is worth checking where the real bottleneck of your system lies</strong>.</p><h3>Conclusion</h3><p>So, did we go through all of this just to learn that the best move is to … wait for the next model? Was it even worth it?</p><p>Well, first, <strong>there are still a lot of cases where TTC scaling can be applied successfully</strong>, so it might be worth trying depending on factors we highlighted below.</p><p>But more importantly, <strong>TTC isn’t just a temporary hack</strong>; <strong>it’s part of the new playbook for cutting-edge AI</strong>. Understanding how it works is your ticket to keeping up with the next wave of tech breakthroughs. Even if you let the big providers handle the complex implementation, knowing the blueprint is how you’ll be ready for what comes next.</p><p>Finally, it is a massive leap forward, but it is not a silver bullet. Models with reasoning abilities still struggle with things like physical common sense, recognizing when a task is impossible, or adapting to new procedures on the fly. <strong>So, having a feeling of how all this works let you use these models accordingly, understanding their strengths and weaknesses</strong>.</p><p>In the age of AI, the ones who truly understand the technology are most probably the ones who will lead the race.</p><h3>Sources</h3><p>All three illustrations without indicated source are from <em>A Visual Guide to Reasoning LLMs</em>. Maarten Grootendorst, 2025.</p><p>Additional resources:</p><ul><li><em>What is test-time compute and how to scale it?</em> Ksenia Se, Alyona Vert, 2024.</li><li><em>Scaling test-time compute with open models</em>. Edward Beeching, Lewis Tunstall, Sasha Rush, 2024.</li><li><em>Learning to reason with LLMs</em>. OpenAi team, 2024.</li><li><em>A Visual Guide to Reasoning LLMs</em>. Maarten Grootendorst, 2025.</li><li><em>Why We Think</em>. Lilian Weng, 2025.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5bccf9c08470" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-from-the-trenches/ai-hit-a-wall-and-the-solution-was-to-teach-it-to-think-longer-5bccf9c08470">AI Hit a Wall and the Solution Was to Teach It to Think Longer</a> was originally published in <a href="https://medium.com/data-from-the-trenches">data from the trenches</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Automating Document Processing With AI]]></title>
            <link>https://medium.com/data-from-the-trenches/automating-document-processing-with-ai-f848d5d97c8d?source=rss----853867ec3a23---4</link>
            <guid isPermaLink="false">https://medium.com/p/f848d5d97c8d</guid>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[document-ai]]></category>
            <dc:creator><![CDATA[Guillaume Cazottes]]></dc:creator>
            <pubDate>Thu, 14 Nov 2024 13:57:07 GMT</pubDate>
            <atom:updated>2024-11-14T13:57:06.931Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="desk set up with laptop and newspaper and coffee" src="https://cdn-images-1.medium.com/max/1024/1*H9LeVSi-TjmMG9AwOxBeHQ.jpeg" /><figcaption>Photo by R<a href="https://pixabay.com/users/rawpixel-4283981/">awpixel</a> on <a href="https://pixabay.com/photos/desk-work-business-office-finance-3139127/">Pixabay</a></figcaption></figure><h4>An Overview of Modern Approaches for the Enterprise</h4><p>Organizations accumulate vast amounts of <strong>key information</strong>, much of which is <strong>locked away in documents</strong>. These documents — whether they are reports, contracts, invoices, or emails — are typically designed for human consumption, making them difficult to process automatically. Fortunately, <strong>Document AI</strong>, the subfield of AI focused on documents, is making rapid and significant progress. In this post, we offer a glimpse into the possibilities offered by modern Document AI. More specifically, we:</p><ul><li>Clarify the scope of Document AI;</li><li>Present its main approaches;</li><li>Illustrate how key Document AI tasks can be concretely performed;</li><li>Introduce a Dataiku sample project that implements most of the techniques discussed.</li></ul><p>Please note that this post does not cover the creation of question-answering systems over multi-page documents since a previous <a href="https://medium.com/data-from-the-trenches/beyond-text-taking-advantage-of-rich-information-sources-with-multimodal-rag-0f98ff077308">article</a> of Data From the Trenches already covers this topic.</p><h3>What Is Document AI?</h3><p>Document AI, or Document Understanding, refers to automatically analyzing scanned or natively digital documents in order to categorize them or extract information from them. Some of the key Document AI tasks are:</p><ul><li><strong>Optical Character Recognition</strong> (OCR): The conversion of the text present in images into machine-encoded text;.</li><li><strong>Layout Analysis</strong>: The analysis of the structure of a document, notably the detection and classification of elements like paragraphs, headings, tables, and images.</li><li><strong>Document Classification</strong>: The categorization of documents into predefined classes (e.g., forms, invoices, emails) based on their content, such as invoices, forms, or emails.</li><li><strong>Visual Question Answering</strong>: A task where a model answers questions based on the visual content of a document.</li><li><strong>Key Information Extraction</strong>: The process of extracting specific structured data (like names, dates, or price) from unstructured documents.</li></ul><p>Handling documents is challenging for three main reasons: they generally combine text and images (e.g., diagrams, charts); their structure is often implicit and only suggested through their layouts; and they come in a variety of formats (e.g., layout, font family, font size). To overcome these obstacles, Document AI takes advantage of methods from both <strong>computer vision</strong> and <strong>natural language processing</strong>, alternatively seeing documents as just images, just texts, or combinations of both.</p><figure><img alt="AI approaches for document analysis" src="https://cdn-images-1.medium.com/max/1024/1*IVAHrFd6NlSsern-akwBEg.png" /><figcaption>AI approaches for document analysis</figcaption></figure><h3>Layout Analysis</h3><p>In this section and the following ones, we illustrate with some examples how Document AI tasks can be performed with open source packages, open weight models, or proprietary API-based LLMs. We first start with <strong>layout analysis</strong>, which is an important prerequisite to receiving meaningful OCR results from documents with non-trivial layouts.</p><p>Current approaches for layout analysis rely on <strong>computer vision models</strong> fine-tuned for object detection specifically in documents. Typical classes are “title”, “text”, “page header”, “section header”, etc. For example, the <a href="https://github.com/Unstructured-IO"><strong>unstructured</strong></a><strong> Python library</strong> makes several of these models available and easy to use, along with other features to parse and process various document formats.</p><figure><img alt="Document after layout analysis" src="https://cdn-images-1.medium.com/max/595/0*cghKgXxbTrMjBCPd" /><figcaption>Document after layout analysis</figcaption></figure><h3>OCR</h3><p>When it comes to OCR, a straightforward approach is to use a <strong>specialized deep learning model</strong> such as the recently published <a href="https://github.com/Ucas-HaoranWei/GOT-OCR2.0">open weight transformer model GOT</a> or the LSTM models embedded in the well-known <a href="https://tesseract-ocr.github.io/tessdoc/">Tesseract open source library</a>. These models are lightweight, fast, and effective.</p><p>However, their performance depends on the practical circumstances of the use case. Whether they perform well for certain languages and for both handwritten and printed text depends on their training dataset. Tesseract is quite ineffective on handwritten documents for instance. Furthermore, image pre-processing steps may be required, such as:</p><ul><li>Isolating the various text boxes in the document with layout analysis.</li><li>Correcting the text orientation with the <a href="https://docs.opencv.org/2.4/modules/imgproc/doc/feature_detection.html#houghlinesp">Hough transform</a>;</li><li>Removing visual noise (i.e., details that are irrelevant for the task at hand);</li><li>Adjusting the scale, brightness, and contrast of the document.</li></ul><p>The recent emergence of powerful <a href="https://medium.com/data-from-the-trenches/demystifying-multimodal-llm-053143c07d6f"><strong>multimodal LLMs</strong></a> (M-LLMs) offers an alternative to these specialized OCR models. With M-LLMs like <a href="https://platform.openai.com/docs/models/gpt-4o">GPT-4o</a> or an open-weight model like <a href="https://huggingface.co/OpenGVLab/InternVL">InternVL</a>, we can simply include the target image in the prompt and ask the model to extract its text content. The level of performance varies with the context of the use case as with specialized models but it is generally very strong.</p><p>However, M-LLMs sometimes exhibit two unwanted behaviors. First, they can add their own comments, such as “The text in the image is…”, to the text extracted from the document. Second, they may correct some words deemed to be misspelled in the original document or even “hallucinate” some content. Both of these problems may require adjusting the prompt or post-processing the LLM output.</p><figure><img alt="Advantages and drawbacks of various OCR approaches" src="https://cdn-images-1.medium.com/max/1024/1*A0UPj8oqCVJHMWd7PLKvMw.png" /><figcaption>Advantages and drawbacks of various OCR approaches</figcaption></figure><h3>Document Classification</h3><p><strong>M-LLMs</strong>, e.g., <a href="https://huggingface.co/Qwen/Qwen2-VL-7B-Instruct">Qwen2-VL</a> or <a href="https://platform.openai.com/docs/models/gpt-4o">GPT-4o</a>, are also strong options to classify documents in a predetermined list of categories (e.g., article, email, letter, form). In this case, the prompt would include the instruction to classify the document, the <strong>list of classes</strong>, the document page to classify, and potentially <strong>few-shot examples</strong> (i.e., some document pages and their ground-truth labels). Since we expect only one of the specified classes, a good practice is to use <strong>structured text generation</strong> techniques, such as function calling or structured outputs, to mitigate or cancel the risk of an invalid answer.</p><p>If a sizable training dataset is available, it is also possible to <strong>fine-tune a model</strong>. <a href="https://huggingface.co/collections/microsoft/udop-65e625124aee97415b88b513">UDOP</a> (Universal Document Processing), an open-weight model, is a strong candidate for Document AI tasks. UDOP uses an OCR engine (Tesseract by default) and processes text, layout, and images as inputs. It is a versatile model, capable of performing various tasks such as document classification, layout analysis, visual question answering, key information extraction, and document generation. It is usually better to use <strong>parameter-efficient fine-tuning</strong> (PEFT) techniques such as <strong>LoRA</strong>,<strong> </strong>especially if the training dataset is relatively small.</p><figure><img alt="Advantages and drawbacks of various document classification approaches" src="https://cdn-images-1.medium.com/max/1024/1*94FiAbh81GIytPy4IyYVtA.png" /><figcaption>Advantages and drawbacks of various document classification approaches</figcaption></figure><h3>Visual Question Answering</h3><p>Here, we restrict ourselves to questions whose answers come from a single page provided along with the question. Question-answering systems which cover whole documents generally require a multimodal Retrieval-Augmented Generation (RAG) approach which is already addressed in a previous <a href="https://medium.com/data-from-the-trenches/beyond-text-taking-advantage-of-rich-information-sources-with-multimodal-rag-0f98ff077308">blog post</a>.</p><p><strong>M-LLMs</strong> like <a href="https://huggingface.co/Qwen/Qwen2-VL-7B-Instruct">Qwen2-VL</a> or <a href="https://platform.openai.com/docs/models/gpt-4o">GPT-4o</a> are the method of choice for visual question-answering tasks, given the general nature of the potential questions, the need to generate some text content and the need to take into account both visual and textual elements of the page. They may be fine-tuned if the domain at hand is very specific but recent M-LLMs generally yield good answers, even in a zero-shot setting.</p><p><strong>Evaluating the quality of question-answering systems</strong> is especially challenging because equally valid answers can be phrased in very different ways and the best approach is generally to use an <a href="https://medium.com/data-from-the-trenches/from-sketch-to-success-strategies-for-building-and-evaluating-an-advanced-rag-system-edd7bc46375d">LLM-as-a-judge technique</a>, i.e., to ask an LLM to assess the generated answers and compare them to ground-truth answers when available.</p><h3>Key Information Extraction</h3><p>In a key information extraction task, we are given a document page, e.g., the scan of a receipt, and we try to extract specific and predetermined pieces of information, e.g., the name and address of the company, the date of the receipt, the amount of the receipt, etc. <strong>M-LLMs </strong>(e.g., <a href="https://huggingface.co/Qwen/Qwen2-VL-7B-Instruct">Qwen2-VL</a> or <a href="https://platform.openai.com/docs/models/gpt-4o">GPT-4o</a> again) are also strong candidates for this task, thanks to their text generation capabilities which are useful when the answer is quite open-ended like in this task. Fine-tuning can help but is often not necessary.</p><p>In this context, M-LLMs are typically prompted to generate a <strong>JSON</strong> object whose properties correspond exactly to the target fields. Even more so than for document classification, <a href="https://medium.com/data-from-the-trenches/taming-llm-outputs-59a58ee3246d"><strong>structured text generation techniques</strong></a> like <strong>function calling</strong> or <strong>structured outputs</strong> are essential to comply with the expected format.</p><h3>Document AI in Dataiku</h3><p>Dataiku users can start exploring the various techniques mentioned above thanks to a public and reusable <a href="https://gallery.dataiku.com/projects/EX_DOCUMENT_AI/">sample project</a> of the Dataiku project gallery. In particular, this project shows how to:</p><ul><li>Perform <strong>layout analysis and OCR</strong> with Unstructured, InternVL and GPT-4o;</li><li>Fine-tune UDOP or leverage GPT-4o or Qwen2-VL for <strong>document classification</strong>;</li><li><strong>Answer questions</strong> based on documents with GPT-4o or Qwen2-VL and <strong>evaluate the corresponding answers</strong>;</li><li><strong>Extract specific fields</strong> from documents with GPT-4o or Qwen2-VL;</li><li>Expose these capabilities in a simple <strong>web application</strong>.</li></ul><h3>Conclusion</h3><p>Recent progress in Document AI enables the automation of an increasingly wide range of tasks. Use cases that would have been particularly challenging a few years ago become achievable. In this context, M-LLMs distinguish themselves with their versatility, user-friendliness, zero-shot or few-shot capabilities, and high performance and will likely play an increasingly important role in this domain. Still, some alternatives remain valid, especially for real-time use cases or in low-resource environments when the computational costs of M-LLMs are excessive.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f848d5d97c8d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-from-the-trenches/automating-document-processing-with-ai-f848d5d97c8d">Automating Document Processing With AI</a> was originally published in <a href="https://medium.com/data-from-the-trenches">data from the trenches</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Taming LLM Outputs]]></title>
            <link>https://medium.com/data-from-the-trenches/taming-llm-outputs-59a58ee3246d?source=rss----853867ec3a23---4</link>
            <guid isPermaLink="false">https://medium.com/p/59a58ee3246d</guid>
            <category><![CDATA[naturallanguageprocessing]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[large-language-models]]></category>
            <dc:creator><![CDATA[Vivien Tran Thien]]></dc:creator>
            <pubDate>Thu, 31 Oct 2024 13:38:43 GMT</pubDate>
            <atom:updated>2025-01-08T13:02:14.514Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="lions jumping through a ring of fire" src="https://cdn-images-1.medium.com/max/1024/1*OWT6kMGzWOVzmUE17Q9qEA.png" /></figure><h4>Your Guide to Structured Text Generation</h4><p><strong>Large language models (LLMs)</strong> are like wild animals — powerful and versatile, but unpredictable and potentially dangerous. This makes deploying robust LLM applications challenging. In this blog post, we present the notion of <strong>structured text generation</strong>, which enables practitioners to “tame” LLMs by imposing formatting constraints on their outputs. More precisely, we will:</p><ul><li>List the <strong>main types of formatting constraints</strong> that structured text generation techniques can handle.</li><li>Explain the <strong>benefits</strong> of structured text generation.</li><li>Provide an overview of the structured text generation <strong>methods</strong>.</li><li>Present the <strong>most commonly available features</strong> for open or proprietary models.</li><li>Describe various <strong>pitfalls</strong> and the practical ways to avoid them.</li></ul><h3>A Spectrum of Possible Constraints</h3><p>Structured text generation methods are available for four main categories of formatting constraints. The simplest one is restricting the LLM’s outputs to a <strong>predefined set of options</strong>. For example, when implementing an <a href="https://huggingface.co/learn/cookbook/en/llm_judge">LLM-as-a-judge approach</a>, we may want to generate a score from 1 to 5, in which case we would expect only five answers: “1”, “2”, “3”, “4”, and “5”.</p><p>More general constraints can be expressed through <strong>regular expressions</strong>. The most typical example is the generation of a JSON object adhering to a specific JSON schema. For example, if we perform sentiment analysis on online reviews, the expected LLM response may be a JSON object with two properties: “sentiment” which is a string with three potential values (“positive”, “negative”, and “neutral”) and “themes” which is a list of strings.</p><p>An even wider family of constraints is based on <strong>formal grammars</strong>, which are particularly interesting when we want to obtain syntactically correct computer code through an LLM.</p><p>Finally, formatting constraints can take the form of <strong>templates</strong>, which are dynamic, fill-in-the-blank texts whose placeholders are meant to be filled by an LLM.</p><figure><img alt="Four overlapping categories of formatting constraints for LLMs" src="https://cdn-images-1.medium.com/max/1000/0*a-qOMaVQFJR9RDHI" /><figcaption><em>Four overlapping categories of formatting constraints for LLMs</em></figcaption></figure><p>Enforcing one of the constraints described above may bring various benefits:</p><ul><li><strong>Guaranteed Validity</strong>: For certain tasks such as text classification or key information extraction, formatting constraints ensure that the answer is valid: All requested fields are present, they can only take allowed values and no unexpected fields have been added. For example, if we are extracting certain fields from a scanned invoice with a multimodal LLM, we may want to systematically get the company name, the total amount, and the date of the invoice. In this case, the answer would be invalid if one of these pieces of information were missing. Note that even with valid formatting, the values within the response can still be incorrect.</li><li><strong>Effortless Parsing</strong>: LLM outputs often contain multiple parts that need to be isolated and fed into a user interface or a downstream application. Being able to generate text following a data serialization format like JSON, XML, or YAML makes this process much easier and more reliable.</li><li><strong>Enhanced Reasoning</strong>: Adding structure requirements can also lead to more relevant responses. The simplest example is the <a href="https://arxiv.org/abs/2201.11903">chain-of-thought</a> method, which involves prompting the LLM to provide a justification before its final answer. This not only makes its output easier to understand and check, but it also has been shown empirically that this approach improves the accuracy of the response.</li></ul><h3>Prompt Engineering and Fine-Tuning</h3><p>LLM developers have a toolbox of techniques at their disposal to impose formatting constraints. The simplest approach relies on <strong>prompt engineering</strong>. This involves explicitly stating the desired format in the prompt or providing examples. This could be as simple as writing “Respond in JSON format” or as detailed as providing a full JSON schema.</p><figure><img alt="Example of a simple prompt specifying a JSON schema for the response" src="https://cdn-images-1.medium.com/max/847/1*5ThHQo8AdQ48aLRwcmp7Ww.png" /><figcaption><em>Example of a simple prompt specifying a JSON schema for the response</em></figcaption></figure><p>While easy to implement, this method often results in too many formatting errors. Moreover, adding more instructions to the prompt increases its length, which leads to higher costs and longer response times.</p><p>For stricter adherence to formatting constraints, we can turn to <strong>supervised fine-tuning</strong>. This consists of further training a pre-trained LLM on a dataset of well-formatted examples. This method yields a <strong>high level of compliance</strong>, but without increasing the prompt size. It can even allow developers to use smaller, more efficient LLM models, further reducing costs and latency. However, fine-tuning requires significant upfront effort. It demands expertise, a base LLM, a well-prepared training dataset, and computing resources (or a fine-tuning feature offered by the provider of an API-based LLM). The training process itself can take hours, delaying the moment when the LLM is ready to be used.</p><figure><img alt="Fine-tuning can improve both compliance and accuracy (and efficiency if a smaller model is used). For a practical example, check out the fine-tuning example in the Dataiku LLM Starter Kit." src="https://cdn-images-1.medium.com/max/789/0*1D_oAzy4cNPAyJmq" /><figcaption><em>Fine-tuning can improve both compliance and accuracy (and efficiency if a smaller model is used). For a practical example, check out the fine-tuning example in the Dataiku </em><a href="https://gallery.dataiku.com/projects/EX_LLM_STARTER_KIT/wiki/1/Project%20description#fine-tuning-llms-1"><em>LLM Starter Kit</em></a><em>.</em></figcaption></figure><p>A special and advanced case of fine-tuning is <strong>function calling</strong>. Some LLMs (including the most prominent proprietary LLMs like GPT-4o and several open-weight models) have been specifically trained to call functions, allowing developers to extend their capabilities. Imagine wanting the LLM to provide the current weather in a city. The LLM itself does not have access to real-time weather data, but you can define a function that does. By including a description of this function in the prompt, the LLM can be trained to recognize when to call this function and how to provide the necessary input in the correct JSON format.</p><p>While this feature is usually used to execute the function and feed the results back to the LLM, it can be cleverly repurposed for enforcing formatting constraints. Instead of a real function, developers can define a dummy function that never actually gets executed but has input parameters structured exactly in the desired format. When the LLM “calls” this function, it generates a JSON object that perfectly matches the constraints. This approach achieves <strong>high compliance</strong> without needing any training data, but it requires the LLM to have been specifically fine-tuned for function calling and <strong>formatting errors remain possible,</strong> even if much less likely.</p><h3>Constrained Decoding</h3><p>The most powerful structured text generation approach is <strong>constrained decoding</strong>, which ensures 100% compliance even for complex constraints. It operates by <strong>masking incompatible tokens</strong> during the text generation process. For example, let’s imagine we prompt an LLM to generate a score on a scale from one to five. In the standard approach, the prompt is converted into a sequence of tokens, which are just words or subwords. These tokens are ingested by the LLM, which returns a vector providing the probability for each potential token to be generated next. The “next token” can then be obtained by sampling this probability distribution. It will likely be “1”, “2”, “3”, “4”, or “5”, but this is not guaranteed.</p><p>With constrained decoding, we automatically build a mask vector which assigns a one to each token compatible with the constraint — in this example, “1”, “2”, “3”, “4”, and “5” — and a zero to all other tokens. If we multiply the probability vector and the mask vector term-wise and then normalize the resulting vector, we obtain a new probability distribution. By sampling this probability distribution instead of the original, we get a next token that will necessarily respect the constraint.</p><figure><img alt="By masking the tokens incompatible with the constraint, we can obtain a next token probability distribution that ensures 100% compliance." src="https://cdn-images-1.medium.com/max/1024/0*zXm8ltLWgBmZZGul" /><figcaption><em>By masking the tokens incompatible with the constraint, we can obtain a next token probability distribution that ensures 100% compliance.</em></figcaption></figure><p>The example above is simplistic because the constraint is limited to a few potential choices and each of these choices corresponds to only a single token. Fortunately, <strong>the token matching approach is generalizable to all the categories of constraints</strong> listed above. For example, with a constraint based on a regular expression, we can build a deterministic finite automaton corresponding to the regular expression, adjust it so that it operates on tokens rather than characters and use it to keep track of the tokens already generated and determine the next tokens permitted by the constraint.</p><figure><img alt="Token masks can be efficiently computed for a regular expression constraint with a deterministic finite automaton. This automaton directly provides all the tokens compatible with the constraint, given all tokens already generated (See Automata-based constraints for language model decoding)." src="https://cdn-images-1.medium.com/max/1024/0*rnhC4mLbJUsOmcct" /><figcaption><em>Token masks can be efficiently computed for a regular expression constraint with a deterministic finite automaton. This automaton directly provides all the tokens compatible with the constraint, given all tokens already generated (See </em><a href="https://arxiv.org/abs/2307.09702">Efficient Guided Generation for Large Language Models</a><em>).</em></figcaption></figure><p>Overall, constrained decoding guarantees <strong>perfect compliance</strong>, does not require training data, and can even <a href="https://lmsys.org/blog/2024-02-05-compressed-fsm/">speed up</a> text generation compared to unconstrained decoding. It introduces some initial overhead (for example to build the automaton in the case of a regular expression) but it is insignificant in most use cases. The disadvantages of constrained decoding are that it is only possible with a proprietary API-based LLM if the provider offers this feature. Constrained decoding also creates some pitfalls described below.</p><h3>Structured Text Generation in Practice</h3><p>In practice, the most popular structured text generation techniques available through open-source packages or features of proprietary LLM APIs are the following:</p><ul><li><strong>Structured Output</strong> corresponds to constrained decoding with a specific JSON schema and 100% compliance. It is the most useful technique for concrete use cases.</li><li><strong>Function Calling</strong> also uses JSON schemas, but does not ensure perfect compliance.</li><li><strong>JSON Mode</strong> is a form of constrained decoding guaranteeing a valid JSON output (but without any JSON schema specified).</li></ul><p>These features are very simple and convenient, but it is easy to overlook <strong>potential pitfalls</strong>. A major source of troubles with constrained decoding is the fact that computing the next token probabilities (before token masking) does not depend on the constraints. In a way, <strong>the LLM is “unaware” of the constraints</strong>.</p><figure><img alt="Enforcing a constraint may change not only the format, but also the substance of an answer." src="https://cdn-images-1.medium.com/max/932/1*twprkmpiTCPFy4EBo-D-Qw.png" /><figcaption><em>Enforcing a constraint may change not only the format, but also the substance of an answer.</em></figcaption></figure><p>In the first of the examples above, we ask an LLM who is the Hand of the King in the second season of Game of Thrones. Without constraints, the LLM is likely to write a paragraph that starts with “The Hand of the King” and includes the correct answer: “Tyrion”. However, if we restrict the potential choices to either “Tyrion” or “Theon”, the answer will incorrectly be “Theon”. This may seem strange because the unconstrained response suggests that the LLM “knows” the right answer, but this behavior is actually explainable given the way constrained decoding works.</p><p>Since “The” is a likely first token and “The” is compatible with the respect of the constraint (because “The” is a prefix of “Theon”), it will not be censored by the token mask and it will likely be selected again as the first token. But then, “Theon” becomes the only permitted answer compatible with the constraint. By enforcing the constraint, we unwittingly increased the odds of “Theon” simply because this particular name happens to have a very common English word as a prefix.</p><p>In the second example, adding a constraint to obtain a date may lead to a “1” being selected for the first token. This first token is compatible with both a DD/MM/YYYY or a MM/DD/YYYY format so it would not be masked with either of these two constraints and the LLM assigns a high probability to “1” because a likely answer starts with “14”. But with the MM/DD/YYYY format, only “0”, “1”, or “2” are allowed for the second token, so it is impossible to generate a correct answer at this point.</p><p>In the third example, we also unintentionally set the LLM on a track that leads to failure. Since tokens are generated one after the other and the LLM does not take into account the constraints when computing the next token probability, the probability to generate “Absolutely” does not depend on the fact that the constraint is “either ‘Absolutely not’ or ‘Definitely’” or “either ‘Absolutely’ or ‘Definitely not’”. Once the first token is generated, there is no choice anymore and having selected “Absolutely” for the first token leads to two opposite answers depending on the constraint.</p><p>The best remedy to this problem is to <strong>specify the constraint in the prompt</strong>, even when leveraging constrained decoding. This limits the gap between the next token probability distribution in the unconstrained vs. constrained case and increases the likelihood that the answer will reflect the internal knowledge of the LLM.</p><p>Some other pitfalls and the associated mitigating strategies are the following:</p><ul><li><strong>Detrimental impact on quality</strong>: Some <a href="https://arxiv.org/abs/2408.02442">anecdotal evidence</a> suggests that imposing constraints might sometimes decrease the quality of LLM outputs for tasks involving logical reasoning or mathematical problem-solving. If this happens and cannot be solved through prompt engineering or by adjusting the constraint, a good approach is to decompose the task into two parts. In the first step, generate the answer without any formatting constraints and in the second step, translate this answer into a properly formatted response.</li><li><strong>Hidden feedback</strong>: The formatting constraint may prevent the LLM from communicating important information. When left unconstrained, the LLM may explain the limitations of its answers or why it may not answer. For example, an LLM may abstain from providing an answer because of the cutoff date of its training corpus. All this useful information may be hidden when a formatting constraint is imposed. If some strange behavior is observed, it is useful to temporarily turn off the constraint to diagnose and solve the problem and then reactivate the constraint.</li><li><strong>Impact of the order of JSON key-value pairs</strong>: While the order of key-value pairs in a JSON object is irrelevant from a data perspective, LLMs can be sensitive to this order. This is because the generation process unfolds sequentially, and earlier parts of the output can influence later parts. Therefore, it is <a href="https://arxiv.org/abs/2408.02442">recommended</a> to structure JSON objects so that the content corresponding to the reasoning process of the LLM (e.g., a justification for an answer) is generated before the content corresponding to the outcome of this reasoning process.</li><li><strong>Limited JSON schema support</strong>: The various constrained decoding implementations do not support all features of the JSON schema specification. For example, the Structured Outputs feature of the OpenAI API <a href="https://platform.openai.com/docs/guides/structured-outputs/supported-schemas">does not allow</a> for optional fields. It is important to consult the relevant documentation to avoid surprises, especially if the JSON schema is complex.</li><li><strong>Underestimating fine-tuning</strong>: While constrained decoding already guarantees compliance, fine-tuning remains a valuable tool. With regard to the first pitfall mentioned above, fine-tuning can be a way to reduce the discrepancy between the unconstrained and constrained behaviors of the model, without lengthening the prompt. It can also help the LLM understand the semantic nuances of the target format. For example, in the case of a sentiment analysis task with three potential classes (“positive”, “neutral”, and “negative”), constrained decoding is enough to guarantee that only these responses will be generated but it cannot make the LLM grasp the somewhat subjective and arbitrary distinction between “neutral” and “positive”, or “neutral” and “negative”.</li></ul><h3>Conclusion</h3><p>Structured text generation is no longer an option; it is a cornerstone of building robust and reliable LLM applications.</p><p>In particular, constrained decoding techniques guarantee 100% compliance. Powerful and simple implementations are available for both open-weight LLMs and proprietary API-based LLMs. Constrained decoding creates some risks, but developers can adequately manage them if they understand the basics of these techniques.</p><p>Dataiku empowers practitioners to tame the powerful, unpredictable nature of LLMs, with safe and precise control. Dataiku provides seamless access to both top LLM services and self-hosted models, along with tools like function calling, JSON mode, and soon, structured output. Whether leveraging open-source tools or the latest APIs, these features allow you to turn LLM potential into structured, impactful content ready for enterprise-grade applications.</p><p><em>Dive deeper into the essentials of structured text generation and learn firsthand how to control and optimize LLM outputs for real-world applications in our webinar, </em><a href="https://content.dataiku.com/llm-responses"><em>“How to Get 100% Well-Formatted LLM Responses.”</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=59a58ee3246d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-from-the-trenches/taming-llm-outputs-59a58ee3246d">Taming LLM Outputs</a> was originally published in <a href="https://medium.com/data-from-the-trenches">data from the trenches</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Tour of Popular Open Source Frameworks for LLM-Powered Agents]]></title>
            <link>https://medium.com/data-from-the-trenches/a-tour-of-popular-open-source-frameworks-for-llm-powered-agents-1cbd9958d227?source=rss----853867ec3a23---4</link>
            <guid isPermaLink="false">https://medium.com/p/1cbd9958d227</guid>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[llm-agent]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Loic Vanel Tabueu Tagne]]></dc:creator>
            <pubDate>Thu, 26 Sep 2024 14:37:47 GMT</pubDate>
            <atom:updated>2024-09-26T14:37:47.072Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="airplane cockpit" src="https://cdn-images-1.medium.com/max/1024/1*ZP3oD4ARrDEMBRKNg22Jxw.png" /><figcaption>Photo by <a href="https://unsplash.com/fr/@caleb_woods">Caleb Woods</a></figcaption></figure><p>One of the most interesting Generative AI trends is the development of agents powered by large language models (LLMs). The word “agent” denotes an automated system that can perceive its environment and take actions. More specifically, in the context of LLMs, as explained in a recent <a href="https://arxiv.org/abs/2407.01502">academic article entitled “AI Agents That Matter,”</a> this word is used mainly when one or several of the following conditions are met:</p><ul><li>The surrounding environment is complex and the potential tasks are open ended.</li><li>The system can be given directives in natural language.</li><li>The system can act with limited or no supervision from a human user.</li><li>The system can use external tools.</li><li>The control flow of the system is dynamic.</li></ul><p>The purpose of this blog post is to present some of the most popular open source Python frameworks used to implement LLM-powered agents. We will focus on the following frameworks and we will highlight their similarities as well as their differences (and summarize them in a table in the appendix):</p><ul><li><a href="https://langchain-ai.github.io/langgraph/">LangGraph</a>: A general, low-level library of the LangChain ecosystem</li><li><a href="https://docs.llamaindex.ai/en/stable/">LlamaIndex</a>: A framework specialized in the implementation of retrieval-augmented LLM pipelines</li><li><a href="https://microsoft.github.io/autogen/">AutoGen</a>: A framework that models an LLM application as a conversation between multiple agents</li><li><a href="https://www.crewai.com/">CrewAI</a>: A multi-agent framework that emphasizes user-friendliness</li></ul><h3>Features Common to All Frameworks</h3><p>Let’s start with the similarities between these frameworks. First, they all offer the possibility to <strong>implement one or several predefined execution logics</strong>. The execution logic defines the sequence of LLM completion queries, tool invocations, and user interactions that allows an agent to complete its task. <a href="https://arxiv.org/abs/2210.03629">ReAct</a> is a popular example of agent execution logic. All frameworks above also allow developers to create customized execution logics.</p><p>Another key feature is the possibility to define tools that agents can use to interact with their environment. From the perspective of an agent, a tool is simply a function that is described in the prompt, can be called with certain input parameters and returns a text output. Typical tools are search engines, web browsers, code interpreters, or messaging services. All frameworks let the developers <strong>use off-the-shelf tools and easily create customized tools</strong>.</p><p>They also include at least some <strong>human-in-the-loop features</strong>. Agents are prone to errors, especially if they need to follow a relatively high number of steps to perform a task. This is especially worrisome if the agents use tools which not only return information but also trigger side effects (e.g., an administrative task which affects the account of a customer). In this context, it may be critical to involve a human user, either to ask clarifying questions on the requested task or to request a confirmation before taking a sensitive action.</p><p>On the technical side, all the frameworks leave users the flexibility to <strong>easily switch from one LLM API to another</strong>. They offer an integration with the OpenAI API and, by extension, they allow developers to connect to the increasingly common OpenAI-compatible APIs. Furthermore, it is relatively straightforward to define custom LLMs and there are also several other LLM integrations available.</p><p>Finally, an unfortunate commonality among the four frameworks is that they offer <strong>limited agent evaluation features</strong>, if any. Depending on the use case, we may want to only evaluate the final answer provided by an agent or its whole trajectory, including the intermediate steps (especially if tools with side effects are used), and we may have access to a ground truth or not. The four frameworks allow developers to fully record the agents’ trajectories but none of them include evaluation features that encompass these four potential scenarios.</p><h3>Single Agent or Multi-Agent Systems?</h3><p>CrewAI and AutoGen are presented as <strong>multi-agent frameworks </strong>while LlamaIndex focuses on <strong>single agent</strong> systems, and LangGraph enables both approaches. In a multi-agent system, several specialized agents collaborate to reach a common objective. The execution logic of the system is then framed as a “conversation” between the agents. The agents can, for example, “speak” one after the other or a “manager” agent can give the floor to the agents when relevant.</p><p>It makes sense to replace a single agent with multiple agents when it would be impossible or impractical to impart a single agent with all the capabilities required for the use case at hand. For instance, a prompt that includes the instructions and examples for all the target capabilities might be exceedingly complex for the LLM or simply too large for its context window. <strong>While managing a single agent is conceptually simpler, combining multiple agents is more modular</strong>: We can develop and test independent specialized agents and combine them to better scale with the complexity of a use case.</p><p>Single agent frameworks are actually also able to model multiple agents because an agent can be packaged as a tool that is then made available to another agent. In this way, the distinction between single agent frameworks and multi-agent frameworks lies more in the developer experience than in their expressiveness.</p><h3>Distinctive Features of Agent Frameworks</h3><p>We now focus on the specific aspects of each framework covered in this blog post.</p><p><strong>LangGraph</strong> has recently become the preferred way of implementing agents in the popular LangChain ecosystem. LangChain includes some agent-related features but many of them are deprecated and planned to be removed in the near future. The promise of LangGraph is the possibility to <strong>implement arbitrary agent execution logic</strong> in a simple manner. This execution logic is declared as a graph which specifies how the state of the agent evolves over time. For example, the graph below corresponds to a tool-augmented agent that requests the validation of a human user for certain sensitive tools. The key features of LangGraph are:</p><ul><li>The <strong>control the behavior of the agent in a very fine-grained manner</strong></li><li><strong>The seamless integration in the LangChain ecosystem</strong> (in particular, the very large number of available built-in tools)</li><li>The creation of <strong>checkpoints</strong> that capture the past and present states of the agent for monitoring and error recovery purposes</li><li>The <strong>evaluation of agents’ trajectories</strong>, to assess the relevance of individual actions (which does not, however, cover the case when a ground truth for the full trajectory is available)</li></ul><figure><img alt="Example of a graph defining the behavior of a LangGraph agent" src="https://cdn-images-1.medium.com/max/483/0*ZInsdfaYzOP7_4ye" /><figcaption><em>Example of a graph defining the behavior of a LangGraph agent</em></figcaption></figure><p><strong>LlamaIndex</strong> is a framework specialized in the creation of <strong>LLM applications that rely on external data sources</strong>. LlamaIndex gives the possibility to create agents among many options to better leverage these data sources. Please note that the LlamaIndex team is currently building <a href="https://www.llamaindex.ai/blog/introducing-llama-agents-a-powerful-framework-for-building-production-multi-agent-ai-systems">llama-agents</a>, a “powerful framework for building production multi-agent AI systems” but we do not cover it in this blog post because it is in an early stage. Some of the most distinctive agent features of LlamaIndex are:</p><ul><li>Several <strong>pre-configured agents</strong> that can directly be used (function calling agent, ReAct agent, and more advanced agent algorithms like Language Agent Tree Search or Chain-of-Abstraction)</li><li>The <strong>compatibility with other LlamaIndex components</strong> and, in particular, the possibility to create tools based on LlamaIndex data query engines</li></ul><p><strong>AutoGen</strong> is a multi-agent framework developed by Microsoft. Its central high-level abstraction is the <strong>conversation</strong>, which corresponds to the execution logic of the multi-agent system. Noteworthy features of AutoGen include:</p><ul><li>A wide range of <strong>conversation patterns</strong> (e.g., group chat with multiple agents, nested chats, speaker selection, etc.) that gives flexibility to create agent workflows of various complexities</li><li>Several options to <strong>involve one or several human users</strong></li><li>A <strong>built-in code execution</strong> component that offers several options (local Shell, Docker Shell, Jupyter Kernel) to let an agent execute automatically generated code</li></ul><p><strong>CrewAI</strong> is a developer-friendly multi-agent framework. It represents multi-agent systems as <strong>“crews” of specialized agents</strong> and its abstractions reflect notions applicable to human teams, such as tasks, processes, collaboration, management, planning, delegation, etc. CrewAI notably offers the following features:</p><ul><li><strong>Definition of the agents</strong> and their interactions<strong> </strong>in a <strong>simple yet flexible</strong> manner</li><li>Management of the <strong>memory</strong> of the agents with four options (short-term memory, long-term memory, entity memory, contextual memory)</li><li><strong>Compatibility with LangChain</strong> LLMs, LangChain tools, <strong>and LlamaIndex</strong> tools</li></ul><h3>Conclusion</h3><p>Although the use of LLM-powered agents is new in real-life use cases, there are already solid options to start implementing agent applications. In this blog post, we presented four agent frameworks with distinct strengths. At this stage, our preliminary generic recommendations would be:</p><ul><li>Use <strong>LangGraph</strong> when the need to define the execution logic in a very fine-grained manner is paramount (for example, in the case of complex human-in-the-loop interactions).</li><li>Use <strong>LlamaIndex</strong> for data-augmented LLM applications (e.g., question answering applications), especially when speed of development and maintainability trump flexibility.</li><li>For tasks that are naturally decomposed in several, well delineated sub-tasks, use <strong>CrewAI</strong> or <strong>AutoGen</strong> depending on the desired balance between speed of development and precise control.</li></ul><p>Whatever framework is chosen and given the LLMs currently available, agents will in any case remain brittle and will need to be carefully designed, tested, and monitored. As illustrated in <a href="https://gallery.dataiku.com/projects/EX_LLM_STARTER_KIT/">the Dataiku LLM Starter Kit</a>, <strong>Dataiku can support the development of agent applications</strong> through various features:</p><ul><li><a href="https://developer.dataiku.com/13/concepts-and-examples/llm-mesh.html#langchain-integration">LangChain integration</a> which ensures all LLMs accessible through Dataiku can be used with LangGraph, LlamaIndex, and CrewAI while a custom LLM can be created for AutoGen</li><li><a href="https://developer.dataiku.com/13/concepts-and-examples/llm-mesh.html#tool-calls">Function calling</a> support</li><li>LLM evaluation (Early Adopter Program)</li><li>Programmatic access to the various objects in Dataiku through the <a href="https://developer.dataiku.com/latest/api-reference/python/index.html">Python API</a>, which facilitates the creation of custom tools</li><li>Easy creation and operation of <a href="https://doc.dataiku.com/dss/latest/webapps/introduction.html">web user interfaces</a></li><li><a href="https://doc.dataiku.com/dss/latest/mlops/experiment-tracking/index.html">Experiment tracking</a> with MLFlow.</li></ul><h3>Appendix: Overview of the Frameworks</h3><figure><img alt="overview of the frameworks" src="https://cdn-images-1.medium.com/max/1024/0*LX1voQ_U0pjOfq7R" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1cbd9958d227" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-from-the-trenches/a-tour-of-popular-open-source-frameworks-for-llm-powered-agents-1cbd9958d227">A Tour of Popular Open Source Frameworks for LLM-Powered Agents</a> was originally published in <a href="https://medium.com/data-from-the-trenches">data from the trenches</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>