Category: Generative AI & Agentic AI

  • How to Build an AI Agent: An Eight-Step Practical Framework

    How to Build an AI Agent: An Eight-Step Practical Framework

    From defining the decision to running an agent that reasons, uses tools and acts within trusted boundaries.

    Consider a key account manager starting her day with a simple question: “What changed in my accounts since yesterday that needs my attention today?”

    Today the answer takes a good part of her morning. She checks orders against forecast, scans for service failures and late deliveries, looks for a competitor promotion or a price change, reviews open claims and deductions, and reads yesterday’s notes in the CRM. A dashboard shows her some of these signals, one screen at a time. A conversational analytics tool lets her ask about them in plain language. An AI agent can do the routine work for her. It can check every account against agreed definitions, pull signals together from several systems, separate real issues from noise, and greet her with a short, prioritized list. Each item explains why it matters, shows the evidence behind it and suggests a next step she can approve.

    The same pattern applies in finance, procurement, supply chain, HR and customer service. Wherever people investigate a problem across several systems before making a decision, an agent can help. That is why so many organizations are now trying to build one. Most of the difficulty, however, sits outside the model. Teams often start with a framework or a model, connect a few tools and write a clever prompt. Weeks later they discover that nobody agreed what a good answer looks like, that the agent calculates a key metric differently from finance, and that there is no way to tell whether last week’s prompt change made things better or worse.

    The starting point for building an AI agent should be the decision it needs to support, not the technology used to build it.

    This blog post is the third in a series. Modern AI Fundamentals explained what an agent is and where it sits among the layers of a modern AI system. Beyond the LLM: Understanding the Agentic AI Harness explained the software scaffolding around the model that lets it use tools, check its work and stay within limits. This post is about the build itself: the eight steps a team works through, in the order the decisions depend on each other, and what good looks like at each step.

    Not every problem needs an agent

    Before the eight steps, one honest question. If a task can be handled reliably by a report, a fixed workflow or a single model call, adding agentic behavior mostly adds cost and things to test. The useful rule is to build the simplest system that works and add autonomy only where the task genuinely needs it. Agents pay off when the path to the answer cannot be fully scripted in advance: several steps, several systems, and choices that depend on what the last step revealed. A straightforward weekly account performance report usually does not need an agent. Investigating unexpected changes across several systems, deciding which issues deserve attention and recommending the next action may justify one.

    The eight steps at a glance

    The framework follows a simple principle: start with the business decision, establish the context and capabilities required to support it, and then design the intelligence and workflows around those requirements.

    Each step builds on decisions made earlier. The business objective determines what the agent needs to understand. Business context informs the tools it needs. Tools and permissions shape its instructions. Only then can we evaluate which model and orchestration approach will work best.

    Although presented as eight steps, agent development is iterative rather than strictly sequential. Evaluation begins with the first use case and continues through design, development, deployment and improvement.

    1. Define the problem, decision and scope: who uses the agent, for which decision, what success means, and the test cases that will prove it.
    2. Establish business context and knowledge: approved definitions, relationships and rules, so correct data leads to correct conclusions.
    3. Define tools, actions and autonomy: a small set of well-defined tools, with autonomy set by the consequence of each action.
    4. Design agent instructions and guardrails: role, context, method, output and guardrails, knowing that prompts guide behavior but do not enforce it.
    5. Select and evaluate the model: the lowest-cost configuration that meets the agreed quality, speed and permission requirements.
    6. Design the agent workflow: orchestration, runtime limits, recovery from failure, approval points, state and memory, and the single-agent versus multi-agent decision.
    7. Design human–agent interaction: evidence, transparency, correction and approval, built around how the user decides.
    8. Evaluate, monitor and improve: traces, regression tests and fresh samples of real use, long after launch.
    Eight steps to building an AI agent, grouped into Define, Design and Build, and Evaluate and Evolve, with a continuous evaluation loop from Step 8 back to Step 1

    One agent through all eight steps

    Before going through the steps one by one, here is how they apply to the key account manager’s morning check from the opening:

    StepThe account manager’s agent
    1. Define the problem, decision and scopeDecide which account issues need attention today. The agent investigates and recommends; the manager decides. Success means a short, trusted priority list before her first call.
    2. Establish business context and knowledgeAgreed definitions for forecast variance, service failure, open claim and an “at risk” account, plus each account’s contract terms.
    3. Define tools, actions and autonomyRead-only tools such as get_sales_vs_forecast, get_service_incidents and get_open_claims. Creating a follow-up task needs her approval; nothing is ever sent to the customer.
    4. Design agent instructions and guardrailsCheck each signal against the approved definition, rank issues by impact and urgency, cite the evidence and flag missing data.
    5. Select and evaluate the modelCompare candidate configurations on past mornings where the right priorities are already known, and choose the cheapest that gets them right.
    6. Design the agent workflowRun every morning before she starts, check accounts in parallel, stop within a time and cost budget, and keep a record of what was checked.
    7. Design human–agent interactionA short ranked list, each item with its evidence and a suggested next step she can approve, edit or dismiss.
    8. Evaluate, monitor and improveA golden set of past mornings, a trace of every run, and a record of which flagged issues she acted on and whether they were real.

    Step 1: Define the problem, decision and scope

    The first step is to agree what the agent is for, in terms precise enough to test. This sounds obvious, yet it is where most agent projects quietly lose their way: a team experiments with frameworks before anyone has written down the business problem, the users or what a good outcome looks like.

    A useful scope answers five questions. What decision does the agent support, and who makes it? What does the user need from the agent to make that decision faster or better? How will we know it works, in measurable terms? What are the boundaries: which data it may see, which actions it may take, and where it must stop and hand over? And how much should it decide on its own: inform only, recommend, or initiate actions?

    The answers should be specific enough to settle arguments later. Name the user role, not “business users”. State the decision, not “insights”. Say plainly whether the agent only informs, recommends, or is allowed to take some actions, and list the actions it must never take. Define success in business terms, such as time to a reliable answer, accuracy against an agreed reference, or adoption by the target users, as well as response quality.

    Two habits make this step far more useful.

    Turn adjectives into conditions you can check. “Accurate” and “helpful” cannot be tested. “The revenue figure matches the finance-approved calculation for the same period” can. So can “every finding cites the records behind it” and “when data is missing, the agent names what it would need rather than guessing.” These become the acceptance criteria for everything that follows.

    Write the first test cases now, not at the end. Collect a handful of real past situations where the right answer is already known, including one or two where nothing unusual happened and the right answer is “no clear cause”. Each case records the question, the data available at the time and the expected findings. This starter set is the first version of the evaluation in Step 8. It forces precision now, and later it lets the team compare models, prompts and tools on evidence instead of impressions.

    Key output: a one-page agent specification covering users, decision, success criteria, boundaries and autonomy level, plus a starter set of test cases with known answers.

    Step 2: Establish business context and knowledge

    Access to data is not the same as understanding the business. An agent can retrieve technically correct data and still reach the wrong conclusion, because enterprise metrics carry meaning that does not live in the tables.

    Take any metric a business argues about. Net sales may be before or after returns, rebates and trade spend. Gross margin may include or exclude freight. A customer may count as “lost” after one missed order cycle or after twelve months of no purchases. On-time delivery may be measured per order, per order line or per shipment. An agent that computes these from raw tables with its own reasonable-sounding assumptions will produce confident numbers that disagree with the ones the leadership team sees every week. From that moment, nobody trusts anything else it says.

    The remedy is to give the agent the organization’s meaning before giving it data. In practice that means four things:

    • Approved definitions for every metric the agent may use, ideally through a governed semantic model or metric layer rather than definitions retyped into a prompt.
    • Relationships between the business entities involved, such as how customers relate to contracts, orders, products and regions, and which hierarchies roll them up.
    • Business rules and exclusions that change interpretation, such as which transactions are out of scope or which thresholds trigger action.
    • Known data caveats, such as a source that updates a day late or a field that is unreliable for certain periods.

    This step also tests the organization’s existing data foundations. If people cannot yet agree on a definition, an agent will not fix that. It will expose the disagreement, quickly and at scale. That is a useful finding in its own right, and a good reason to treat semantic grounding as a design step rather than a technical detail.

    Key output: the approved metric definitions, entity relationships, business rules and data caveats the agent depends on, exposed through governed sources it can query.

    Step 3: Define tools, actions and autonomy

    A model can interpret a question and reason about it, but it cannot see live enterprise data or change anything without tools. Tools are where the agent meets the business, which makes them the most consequential design surface in the build.

    The common integration routes are well known: APIs and custom functions, SQL and analytical services over governed data, retrieval over documents and policies, the Model Context Protocol (MCP) as a standard way to expose tools to any compatible application, and interfaces to other agents. The harder questions are about design.

    Few, narrow and clearly named. An agent chooses tools by reading their names and descriptions, so a vague tool is a tool used wrongly. A tool such as get_sales_vs_forecast(account, period), with a clear description of each parameter, is far safer than a general run_sql(query). Each tool needs a contract: what goes in, what comes out, and what it returns when something fails. A timeout, an empty result and a permission error should look different to the agent, because each calls for a different next step.

    Here is what a call to get_sales_vs_forecast can return, and what the agent should do with each result:

    What the tool returnsWhat it meansWhat the agent should do
    Valid resultSales and forecast figures for the account and periodUse them, citing the source and period
    Empty resultThe query worked but found no recordsSay that no data was found; never read it as zero sales or a decline
    TimeoutThe source system did not respond in timeRetry once; if it still fails, report the account as not checked
    Permission deniedThe user is not allowed to see this accountStop for that account and say access is restricted; never look for a way around it

    The tool contract defines these four outcomes; the instructions in Step 4 tell the agent how to respond to each. Without both, an empty result can easily turn into a confident but false story about falling sales.

    Read before write. A first release usually needs only read tools: the data and documents the agent must examine. Actions that change external systems, such as creating a task, updating a record, saving a draft to a CRM or sending a customer message, can be introduced later with appropriate permissions and approvals.

    Set autonomy by consequence, not by capability. How much an agent decides on its own is only half the question. The other half is how much damage a wrong decision can do: how easily the action can be reversed and how far its effects spread. A read that exposes confidential customer terms, a draft that a person reviews, a task sent to another team and a change to a live production plan sit at very different points on that scale. Two agents with the same autonomy can need very different oversight.

    Type of actionReversibility / ExposureReach if wrongTypical control
    Read business dataNo system change; disclosure may be irreversibleSensitive data seen by the wrong peopleAllowed; access limited to what the user may see
    Draft analysis or a recommendationFully reversibleMisleads one decisionAllowed; user reviews before acting or sharing
    Create an internal task or requestReversible; can be withdrawnAnother team’s timeProposed; user approves each one
    Send a message outside the companyIrreversible once sentCustomer or supplier relationshipUser approves exact content and recipient
    Change prices, orders, plans or master dataHard to reverseCustomers, revenue, operationsNot permitted, or only through the existing approval process

    Two further safeguards belong here. Treat retrieved text as data, not instructions: a customer email, a supplier document or a page in a knowledge base can contain text that looks like an instruction, and the agent must not follow it. And a tool request is not proof that anything happened. If the agent says it created a task, the application, not the model’s sentence, should confirm that the task exists.

    Key output: a tool registry with contracts and failure behavior, and a permission model that maps every action to its reversibility, reach and required approval.

    Step 4: Design agent instructions and guardrails

    With the decision, the meaning and the tools settled, the system prompt has something concrete to say. This ordering matters. A prompt written on day one tends to be a persona (“You are an expert business analyst”) and a list of hopes. A prompt written after Steps 1 to 3 can describe a method.

    A good instruction set for a business agent covers five things:

    • Role and goal: what the agent is responsible for, and for whom.
    • Business context: which definitions apply and where to find them, rather than restating every rule in prose.
    • Method: how to approach an investigation, which tools to use for which questions, and in what order.
    • Output: how findings, evidence, uncertainty and recommendations should be presented.
    • Guardrails: what the agent must not do, and when it should ask for clarification or escalate.

    The method is where most of the value lies. For an investigative agent it might say: confirm the change you are asked about using the approved calculation before looking for causes; break it down by the standard business dimensions before examining individual records; test each candidate explanation against the data rather than accepting the first plausible story; quantify each driver where the data allows; and keep what the evidence shows separate from what remains a hypothesis. The guardrails might say: never present an unsupported explanation as a conclusion; when the data needed to test an explanation is missing, name it instead of filling the gap; never recommend an action outside the user’s authority.

    One distinction deserves to be stated plainly, because it is the most common misunderstanding in agent projects: prompts guide behavior, but they do not enforce security. “Do not show other regions’ data” in a prompt is a request. Restricting the data tool to the user’s regions is a control. Prompt rules and code checks have different jobs. The prompt shapes judgment and style; the application enforces access, permissions, approvals and anything else that must hold every single time.

    Key output: agent instructions covering role, context, method, output and guardrails, with every hard rule also implemented as a check in the application.

    Step 5: Select and evaluate the model

    Model choice usually comes early in agent projects, often as the first decision. It belongs here, after the task, tools and instructions exist, because only then is there a real workload to test candidates against.

    The main model families, including OpenAI GPT, Anthropic Claude, Google Gemini, Meta Llama and NVIDIA Nemotron, differ in ways that matter for agents:

    • Reasoning: can it follow a multi-step method and change course when the evidence contradicts its first hypothesis?
    • Tool use: does it pick the right tool, pass valid parameters and interpret the result correctly, including errors?
    • Context handling: can it work with the definitions, intermediate results and conversation history it needs without losing track?
    • Cost and latency: can it meet response-time and budget expectations at the expected volume?
    • Deployment and governance: does it meet requirements for hosting, data residency, privacy and operational control?

    The practical way to choose is to run the starter test cases from Step 1 through a small set of candidate configurations and compare them on the same evaluation. Depending on the model and provider, configuration options may include reasoning effort, thinking budgets, tool-use settings and generation parameters. These should be evaluated as part of the overall model configuration rather than treated as interchangeable capabilities. The goal is the lowest-cost configuration that meets the agreed quality, speed and permission requirements, not the most capable model available.

    Two cautions help here. First, compare the cost of a completed, verified investigation, not the price per token: a cheaper model that needs three retries and more tool calls can cost more than a stronger one that gets it right first time. Second, more reasoning does not compensate for an unclear requirement or a missing test. If every configuration fails the same case, look at the specification, the tools or the data before buying a bigger model.

    Some architectures route between models: a small, fast model classifies the request or handles simple lookups, while a stronger model handles the investigation itself. That can work well, but each route needs its own evaluation.

    Key output: a chosen model and reasoning setting, or a routing strategy, backed by results on the agreed test cases, with cost and latency per completed task.

    Step 6: Design the agent workflow

    Orchestration decides how the work actually flows: which steps are fixed by design, which are left to the model, how intermediate results are kept, what happens when something fails, and where a person steps in.

    The first decision is how much of the path to script. Some steps should always happen the same way: validate the starting figures against the approved calculation, apply the standard breakdowns, check the user’s permissions. Those belong in a fixed workflow. Other steps depend on what the earlier ones reveal. If one product line explains most of a decline, the agent should dig into it; if the decline is spread thinly everywhere, it should look for a common cause such as pricing or availability. That part benefits from letting the model choose its next step. Most good enterprise agents are a mix: a designed backbone with model-directed investigation inside it.

    A typical flow looks like this. Understand and confirm the request. Gather and validate the core data. Investigate candidate explanations, in parallel where they are independent. Quantify what each one contributes. Draft findings and recommended actions. Then stop and hand over to the user, who approves anything that changes the world outside the agent.

    It helps to separate two ideas that are often blurred. Orchestration describes how work is coordinated: which steps execute, how decisions are made, when tools are called and where human approval is required. The agent runtime, or harness, provides the execution environment and controls needed to operate that workflow reliably, including tool execution, state management, permission enforcement, retries and monitoring. In practice, orchestration and runtime capabilities may be implemented within the same framework or platform.

    Whatever the pattern, the loop needs limits that the runtime enforces, not the model. A model can propose that it is finished; the harness decides when it must stop. That means caps on steps, time and spend; a defined outcome when a limit is reached (report what was found and what remains open, rather than failing silently); retries with sensible backoff; and careful handling of uncertain outcomes. A timeout on a write does not mean the write failed, so the agent must check before trying again. Approvals belong at the point of action, too. Approving a plan at the start does not authorize a different action the agent decides on later. The harness post covers these mechanics in more depth.

    One agent or several? A single agent with well-designed tools is almost always the right starting point. Multiple agents help when subtasks are genuinely independent, need different tools or permissions, or would overload one context. For example, separate investigators for pricing, product availability and customer behavior could work in parallel and return their findings to a coordinator. The cost is real, though. Coordination, debugging, evaluation and token use all grow. In its account of its own multi-agent research system, Anthropic reported that agents typically used about four times as many tokens as chat interactions, and multi-agent systems about 15 times as many. Those figures describe Anthropic’s research workload measured against chat, not agent systems in general, but the direction is worth remembering. Add agents when a single agent demonstrably falls short, not because the architecture diagram looks more impressive.

    Frameworks such as LangGraph, Microsoft Agent Framework, OpenAI Agents SDK, Claude Agent SDK and Google’s Agent Development Kit implement these patterns in different ways. For long-running or high-volume work, workflow engines, queues and schedulers may also be needed.

    The objective is not to build the maximum number of agents. It is to design the simplest reliable workflow that solves the problem.

    Managing context, memory and workflow state

    Three kinds of information keep an agent on track, and they are easy to confuse:

    • Context: the relevant information available to the model for the current reasoning step, such as the user’s question, the definitions that apply and the latest tool results.
    • Memory: information intentionally retained and retrieved across interactions or sessions, such as a user’s preferred views or the outcome of a past investigation.
    • Workflow state: a structured record of execution progress, tool results, approvals and pending activities.

    An agent’s conversation history is not the same as its workflow state. Conversation context helps maintain continuity with the user, so that a follow-up such as “now compare it with last year” keeps the same scope. Workflow state ensures that tasks can be resumed, retried, audited and completed reliably, even if the conversation ends or a step fails halfway. Long-term memory should be introduced selectively, with clear rules governing what is retained, for how long, who can see it and how it is used. Stale memory quietly introduces outdated assumptions, and authoritative business records belong in the systems of record, not in the agent’s memory.

    Anatomy of an enterprise AI agent: the agent runtime holds instructions, model, workflow and context, memory and workflow state; it sits between the problem and human-agent interaction above and business context and tools above enterprise systems below, with security and observability across all layers
    Figure 2. What each step puts in place. The agent runtime sits at the center; security and observability apply across every layer.

    Key output: a workflow design that separates fixed and model-directed steps, with enforced limits, failure handling, approval points and a reasoned single-agent or multi-agent choice.

    Step 7: Design human–agent interaction

    An agent’s value depends as much on how people work with it as on what it can do. The interface might be a chat window, a panel inside an existing planning tool, an API called by another system or a background process that reports when something changes. For business decisions, a chat window alone is rarely enough, because people need to inspect evidence, not just read an answer.

    A good agent experience helps the user to:

    • Ask naturally, in the language of the business, without knowing table names.
    • See what the agent is doing: which data it checked and which hypotheses it ruled out.
    • Check the evidence behind each finding, down to the records involved.
    • Correct the agent, for example to exclude a customer or change the comparison period, without starting over.
    • Approve or reject consequential actions, one at a time, with a clear view of what will happen.

    In practice, the best answers often combine a short narrative, a chart of the main drivers, the supporting figures and a list of recommended actions. The user can drill into one driver, ask a follow-up question or reject a recommendation, and the agent keeps the context. Recommendations stay proposals until the user approves them, and approved actions are carried out and confirmed by the application, not just promised in text.

    This is where human-centered design matters most. The aim is not to show off the model’s intelligence. It is to fit the agent into the way the user actually makes the decision, reduce friction, and leave them in control of what happens next. Done well, it is also how the agent earns trust: users who can see the evidence come back.

    Key output: an interaction design covering how questions are asked, how evidence and reasoning are shown, how users correct the agent, and how actions are approved.

    Step 8: Evaluate, monitor and improve

    Agents are harder to test than ordinary software because their behavior shifts with the prompt, the context, the data returned and the model itself. An agent can write a convincing explanation while using the wrong metric definition, skipping a relevant data source or attributing a change to a cause that the evidence does not support. Testing has to cover the quality of the reasoning and actions, not just whether the code runs.

    The evaluation that started as a handful of known cases in Step 1 now grows into a working system:

    DimensionWhat to check
    Calculation correctnessKey figures match the reference calculation for the same scope and period
    Tool useRight tools, valid parameters, sensible order, errors handled
    GroundingEvery finding traces to data the agent actually retrieved; hypotheses are labeled as such
    CompletenessAll material causes considered; nothing dropped silently when a limit is reached
    BoundariesNo access beyond the user’s permissions; no action without approval
    Cost and speedTokens, tool calls and time per completed task
    Business usefulnessDid users act on the output, and was it right?

    Five habits make this work.

    Trace everything. The final answer hides how it was produced. Observability tools such as Arize Phoenix, LangSmith and Langfuse record each model call, tool call, result and error as a trace, so a reviewer can see where an investigation went wrong. Traces provide visibility into observable execution steps and decisions, but they should not be confused with a complete or necessarily faithful record of a model’s internal reasoning.

    Read traces before writing graders. Review real runs, write specific notes on what went wrong, then group the notes into failure types. This error-analysis approach, popularized by Hamel Husain and Shreya Shankar, finds the failures that matter instead of the ones that are easy to measure. A domain expert from the business, not the engineering team, decides what counts as a correct answer.

    Use code where code can judge. Whether the agent’s figures match the reference calculation is a deterministic check. Whether its explanation is supported by the evidence is a judgment, which an AI grader can help with at scale, but only after its verdicts have been compared against cases the expert has already labeled.

    Protect what already works. Every confirmed failure becomes a test case in a growing golden set, and every prompt, tool or model change runs against it before release. Decide what result would justify the release before looking at the scores, and keep some cases untouched so improvements are not simply tuned to the test.

    Keep sampling real use. A golden set only catches failures you already understand. Fresh traces from real users show the questions and situations nobody anticipated.

    A worked test case

    Consider one test question: “Why did net sales decline by 5% in the North region last month?”

    Before the agent ever sees it, the team writes down the expected behavior. The agent should verify the decline against the approved net sales definition. It should identify and quantify the principal contributing factors, such as volume, price, mix or a lost customer. It should retrieve evidence for every material explanation, keep findings separate from hypotheses, and take no action it is not authorized to take.

    Each part of that expectation is then checked in the way that suits it:

    What is checkedHow it is checked
    Metric accuracyDeterministic comparison with the reference calculation
    Explanation qualityExpert review, or an AI grader calibrated against expert judgments
    Tool permissionsAutomated policy and integration tests

    Once the expected behavior is agreed, the case joins the golden set and runs on every future change. A prompt tweak that improves the narrative but breaks the calculation, or a new tool that quietly widens data access, is caught before users see it.

    The harness post walks through this evaluation loop in more detail.

    Key output: tracing in production, a golden set with expert-approved expectations, code checks and calibrated AI graders, and a release process that runs them on every change.

    From business question to approved action

    Put together, the eight steps produce something simple to describe. Return to the key account manager’s morning question. The agent reads the signals, investigates them against approved definitions, shows the evidence, and proposes a short list of priorities. She decides what happens next, and the outcomes feed back into tomorrow’s prioritization and the evaluation set.

    From business question to approved action: signals, investigation, evidence, prioritized recommendations, approved actions and outcome measurement
    Figure 3. A key account manager’s daily check, end to end. The agent does the routine work; consequential actions pass through a human decision.

    Measuring business value

    It helps to think about evaluation at three levels, each answering a different question:

    1. Model quality: does the model reason correctly, follow instructions and use tools appropriately?
    2. Agent reliability: does the end-to-end workflow complete correctly, safely, consistently and within operational limits?
    3. Business effectiveness: does the agent improve decisions, productivity, adoption or measurable business outcomes?
    Three levels of agent evaluation: model quality, agent reliability and business effectiveness, each with its question and how it is measured
    Figure 4. Three levels of agent evaluation, from technical quality to business value.

    Step 8 covers the first two levels. The third is the one leadership asks about, and it is the subject of this section.

    An agent can pass every technical test and still deliver little, if it does not improve a real business process. Value measurement therefore needs to be designed alongside the technical evaluation, starting from the success criteria in Step 1, not added after launch when someone asks for a business case.

    Useful measures usually include:

    • Time to a reliable answer, compared with the manual baseline.
    • Effort released from routine data gathering and reconciliation.
    • Share of outputs that lead to an action, and how often the agent’s findings are later confirmed.
    • Adoption: repeat use by the intended users, not just first-week curiosity.
    • Business outcomes in the process the agent supports, such as retained revenue, lower cost or fewer service failures, where they can be traced to the agent.

    The last measure is the hardest and the most important. Business results move for many reasons, so the agent’s contribution should be separated from other changes wherever possible, for example by comparing teams that adopted it with those that have not yet.

    Technical metrics tell us whether the agent works. Business metrics tell us whether it creates value.

    From agentic workflows to Decision Intelligence

    AI agents are an important capability in the broader evolution of business analytics, but they are not the destination in themselves.

    Traditional analytics helps organizations understand performance. Conversational AI makes information easier to explore. AI agents extend these capabilities by coordinating investigations, interacting with enterprise systems and supporting actions. Decision Intelligence brings these elements together around the decisions people need to make.

    An agent can investigate why sales declined, but a Decision Product connects that investigation with business context, alternative courses of action, expected outcomes and the workflow through which decisions are made. This distinction matters. Agentic AI provides the ability to investigate and act. Decision Intelligence provides the context and discipline to determine which actions make business sense.

    The opportunity is not simply to make existing analytical processes autonomous. It is to redesign how intelligence, human judgment and business execution come together. My next blog post looks at what this means for the future of BI.

    A practical way to start

    None of this requires a large agent platform or a multi-agent architecture on day one. The teams that get value fastest pick one meaningful, frequent decision and build the smallest agent that supports it well: trusted definitions, a few read-only tools, clear boundaries and a set of test cases with known answers. They test against those cases before anyone outside the team sees it, put it in front of a small group of real users, and learn from the traces.

    Only when that first version is reliable and useful do they add capability, one piece at a time: write actions with approvals, scheduled or event-triggered runs, longer-term memory of user preferences, specialist sub-agents or integration with execution systems. Each addition comes with its own test cases. It is the same discipline as good product design: understand the problem, build the minimum useful capability, and improve on evidence.

    Before you build: an AI agent readiness checklist

    One line per step. If any item is still open, that is where to focus before building further.

    • A clearly defined business decision and target user
    • Agreed success criteria and known-answer test cases
    • Approved business definitions and governed data access
    • Tool contracts, permissions and action boundaries
    • Model configuration selected through evaluation
    • Workflow state, execution limits and failure recovery
    • Evidence-based user experience and approval controls
    • Production tracing, regression tests and value measurement

    Final thoughts: build agents around decisions, not technology

    Building an AI agent is not a matter of choosing a model, writing a prompt and connecting a few tools. As the tools mature, building one will keep getting easier. Making it dependable, relevant and valuable will remain a product-design and systems-engineering challenge.

    The most successful agents will not be the ones with the most sophisticated model, the most tools or the most autonomy. They will be the ones that solve meaningful problems, operate within trusted boundaries and help people make better decisions.

    The future of AI agents is not just about making systems more autonomous. It is about making intelligence more useful, decisions more informed, and actions more effective.

    Further reading

  • Beyond the LLM: Understanding the Agentic AI Harness

    Beyond the LLM: Understanding the Agentic AI Harness

    How prompts, context, execution loops and orchestration turn language models into systems that can act, observe and verify.

    Consider a question a category manager might ask on a Monday morning: “Why did our seasonal chocolate SKU go out of stock at a key retail account last week, and what should we do about it?” A large language model (LLM) can describe a sensible investigation: compare sell-through with shipments, check the forecast, look for a promotion that lifted demand. Answering the question takes more. Someone has to query point-of-sale, shipment and forecast data, reconcile the figures to governed definitions, test a hypothesis against the evidence and route any replenishment change to a planner for approval.

    That is the difference between a model that describes what should be done and a system that can actually do it. LLMs can interpret instructions, reason through problems and propose actions, but on their own they cannot run a query, check a result or change a plan.

    The model provides much of the intelligence for these decisions. The software environment that enables controlled execution is the agentic AI harness. It connects model-generated proposals to tools, task state and feedback, allowing an AI system to perform work, observe results and verify progress.

    The model proposes what to do. The harness makes controlled execution, observation and verification possible.

    My earlier blog post, Modern AI Fundamentals: From Models to Agentic Systems, introduced the broader AI building blocks. This blog post focuses on the engineering environment that connects those building blocks to action.

    What Is an Agentic AI Harness?

    An agentic AI harness is the software surrounding a language model that supplies relevant information and capabilities, executes permitted actions, returns observations and supports iterative progress toward a goal. A model on its own does not open data sources, run queries, modify records or establish that a recommendation is supported by evidence. Those functions require software beyond the model. A useful architectural shorthand is Agentic System = Model + Harness: the model contributes intelligence and proposes actions; the harness provides the context, tools, execution environment and controls.

    A harness commonly supplies instructions and context; exposes tools such as databases, semantic models, files, searches and APIs; executes permitted requests; returns errors and results; maintains task continuity; and enforces stopping and verification conditions. Implementations differ between coding environments and runtime business applications, but the responsibilities are the same.

    Diagram of an agentic AI harness. Inside the harness, the four control surfaces (Prompt, Context, Loop, Graph) sit above the language model, which sends proposed steps to execution controls; these call tools and enterprise systems and return observations. State and memory, verification and observability sit below, and verification either loops back to the model or releases a verified outcome.
    Figure 1. The anatomy of an agentic AI harness. The four control surfaces shape the model’s work; execution controls, state, verification and observability turn its proposals into controlled action.

    Model, harness and environment

    ComponentPrimary responsibility
    Language modelInterprets inputs and proposes responses or next steps
    Agentic harnessSupplies context, exposes tools, manages permitted execution and returns observations
    Tools and environmentPerform operations: queries, files, code, searches and APIs
    Application stateRecords progress and durable workflow information
    Human or evaluatorDefines acceptable behavior and judges consequential outcomes

    In the out-of-stock investigation, the model might propose querying shipments to the retailer’s distribution centers for the past four weeks. The harness checks that the user is allowed to see that data, runs the query against the governed semantic model and returns a summary. The model then considers the evidence and selects another step or reports its finding. The crucial design question is how much control should be delegated to the model.

    Why the Harness Matters

    The same underlying model can produce very different results depending on its execution environment. Ask a model to fix a faulty promotion-lift calculation in a plain chat window and it can only propose a correction to whatever code is pasted in; it cannot see the rest of the pipeline or run the tests. Place the same model inside a coding harness and file access can expose the missing context, while a test run can reveal a mistaken assumption. The model has not changed. The evidence available to it has.

    Industry research points the same way. NVIDIA’s research on agent harness capabilities found that harness design alone can account for double-digit swings in benchmark results, and significant differences in token cost, with the same underlying model. The practical lesson is to evaluate the model and the harness together: hold the tasks and acceptance criteria fixed, then compare completion quality, cost and time across pairings. Better tools improve the evidence; they do not guarantee that a weaker model will solve a harder problem.

    One particularly important failure is false success: an agent confidently reports completion even though the intended work remains unfinished. This can happen when a tool returns a success status but the business acceptance criteria have not been checked. Stopping is not the same as succeeding, and a model’s statement that it saved a record is not evidence that the record was written. Verification must examine evidence of the actual outcome, not merely whether an action was attempted.

    For business leaders, this changes the question. When an agent underperforms, the instinct is to ask for a better model. Often the better question is what the harness failed to provide.

    Four Control Surfaces of the Harness

    A practical way to design a harness, drawn from IISc’s Agentic AI Coding program, is to think in terms of four control surfaces: Prompt, Context, Loop and Graph. A control surface is a part of the system we can configure to influence its behavior. These are not four sequential stages, and they overlap. Their value is diagnostic: when an agent goes wrong, they help locate the control that was missing.

    Four cards, one per control surface. Prompt: what do we want; weak prompts mean unstated requirements are guessed. Context: what can the model see; weak context means stale or missing requirements. Loop: what happens next; a weak loop allows unsupported completion claims or out-of-scope actions. Graph: how is work combined; a weak graph causes conflicting work or lost information. Each card includes a promotion-analytics example.
    Figure 2. The four control surfaces, what each controls, how each fails, and how each applies to a promotion investigation.

    Prompt — What do we want?

    The prompt is the current instruction: the task, its scope and the changes that are excluded. “Analyze last quarter’s promotions” leaves undefined which retailers, which measure of lift, which baseline and whether the agent may change anything. When requirements are unstated, the agent fills the gaps with defaults that may look reasonable and still be wrong for the business. Instructions shape the model, but executable permissions and validation must still be enforced outside it.

    Context — What can the model see?

    Context is the information available to the model now: the maintained specification, governed business definitions, relevant data, tool descriptions, tool results, conversation history and task state. This is where specification-driven development earns its place. A reviewed specification, written before implementation, records intended behavior and acceptance criteria, so later work has a durable reference rather than a remembered conversation.

    More context is not automatically better. An investigation into one retailer’s out-of-stock needs that account’s shipments, forecast and promotion calendar, not every sales table in the enterprise. Instructions, tool descriptions, retrieved material and history all compete for the same limited capacity, so the harness may summarize, drop or selectively load material as work proceeds. Context engineering selects and structures the information relevant to the next decision.

    Context is information currently supplied to the model. Memory is information retained for later use. State is the recorded condition or progress of a workflow. The context window is not a durable database; long-running work may require persistence to resume safely or to determine whether an external action, such as a replenishment request, was already submitted.

    Loop — What happens next?

    The loop owns execution, checking, recovery and stopping rules. It allows the system to inspect, act, observe, revise and verify rather than ending after one model response. It also needs boundaries: successful acceptance checks, permissions, iteration and cost limits, unresolved uncertainty or required human approval. Attempting a tool operation is not the same as achieving the user’s goal.

    Graph — How is work combined?

    Some tasks need one iterative loop; others need conditional branches, dependencies or specialized workers. An implementation can be followed by independent review; a retailer’s trade-promotion claim may require extraction, validation against agreed terms, approval and settlement. The graph expresses those handoffs, along with ownership and the state that passes between steps. Complexity should be justified by the task rather than by a desire to maximize autonomy.

    In short, the Loop governs how an execution cycle continues and stops; the Graph governs how steps, dependencies, branches and specialized workers are connected.

    Putting the Four Surfaces to Work: CPG Promotion Intelligence

    Consider an assistant investigating why a retailer promotion delivered lower-than-expected incremental volume. Prompt defines the task and forbids changing commercial plans. Context supplies governed net-sales and volume measures, retailer and SKU hierarchies, the promotion calendar and approved baseline definitions. Loop runs a bounded sequence of query, compare, validate and revise. Graph connects pricing analysis, availability checks and a final reviewer approval when those steps are needed. A credible finding might show that reduced on-shelf availability contributed to weak promotion performance, but that explanation must be supported by data, not merely inferred from the sales decline.

    Inside the Agentic Execution Loop

    The loop has five functions. The system perceives the goal and relevant task information, reasons about an appropriate next step, acts by requesting a permitted tool operation through the harness, observes the actual result, error or changed environment, and verifies that evidence against the requirements. When verification shows unfinished work, the sequence repeats; the infographic in the earlier blog post labels that repetition Iterate. These are functions rather than five mandatory software stages, and a limit, an error or a request for clarification can interrupt the cycle at any point.

    Circular diagram of the agentic loop for the out-of-stock investigation: Perceive, Reason, Act (highlighted because the harness checks permission before running a read-only query), Observe and Verify, with Iterate in the center. A side panel lists five ways the loop stops, noting that only meeting acceptance criteria with evidence supports a completion claim.
    Figure 3. The execution loop applied to the out-of-stock investigation, with the five ways a well-designed loop stops.

    Imagine a coding agent fixing a promotion-analytics pipeline that double-counts sales when two promotions overlap for the same SKU and week. It inspects the failing test and the join logic, proposes a change, invokes a file tool, reruns the tests and examines the result. Even a green test does not necessarily prove every overlap case is handled, such as a multi-buy offer running alongside a temporary price reduction. Verification depends on agreed acceptance criteria and sufficient evidence.

    Every loop needs explicit exits: the acceptance criteria are met; a step, time or cost limit is reached; an error cannot be recovered safely; a consequential action needs approval; or the request needs clarification. Only the first exit supports a completion claim. The others should be reported as gaps, not as finished work.

    The agentic loop is therefore not merely repeated prompting. It is structured interaction between decisions, actions, observations and verification.

    From Model Calls to Autonomous Agents

    Not every AI application with retrieval or tools is an autonomous agent. The earlier blog post introduced a spectrum of delegated control; it matters here because it determines how much the harness must do.

    Agency categoryArchitectureWho decides what happens next?
    None (L0)Fixed prompt and model callApplication
    Level 1: Augmented InteractionBounded interaction with retrieval, tools or memoryPrimarily application
    Level 2: WorkflowEngineer-defined multi-step coordinationWorkflow with selected model decisions
    Level 3: Autonomous AgentModel chooses successive steps and toolsModel within harness constraints

    The defining question is who selects the next action, not how many model calls or tools are present. A program that always fetches shipments and then asks a model to summarize them is not autonomous, however many tools it calls. A fixed workflow for matching retailer deductions to promotion terms may be more reliable than an autonomous agent when those terms are stable. Use the least complex system that meets the requirement: each added degree of autonomy introduces decisions that must be tested and controlled, so compare quality, cost and time on representative tasks before adding a more elaborate loop.

    Autonomy and consequence are separate axes

    Autonomy describes who decides the next step. It says nothing about how much damage a wrong decision can cause. That is a second axis, defined by reversibility, how easily an action can be undone, and blast radius, how widely an error can spread across data, users or services. A read-only out-of-stock investigation and an agent that expedites replenishment orders may sit at the same agency level, yet only one of them can create a duplicate order or move inventory. Read-only access is not automatically safe either: it can still expose sensitive commercial data.

    Chart with autonomy level L0 to L3 on the horizontal axis and consequence from low to high on the vertical axis. Low-consequence examples include drafting promotion commentary, looking up a retailer’s shipments and a read-only out-of-stock investigation. High-consequence examples in a shaded approval zone include issuing a retailer credit and expediting a replenishment order. A side note explains that two tasks at the same level can carry very different risk.
    Figure 4. Illustrative CPG tasks placed by autonomy and by consequence. Oversight should follow the consequence of an action, not only the level of autonomy.

    Tools, Tool Calling and MCP

    Several terms describe different responsibilities, and they need not map to separate software products. A language model generates responses and proposes next steps; an agent pursues a goal through model-directed decisions; a harness supplies the execution environment and controls; an orchestrator coordinates dependencies and handoffs, often inside the harness; and MCP standardizes how applications reach external tools and resources.

    The harness point is the separation of duties. The model requests a structured operation, such as a query for shipments to one retailer. The harness checks the operation and its arguments, dispatches it if permitted and returns the result as the next observation. A tool request in model output is therefore not evidence that anything happened. That separation is what allows access controls, argument checks, approval gates and error handling to live outside the model, and it means the harness must handle each possible outcome deliberately:

    What the model returnsHow the harness responds
    A tool requestCheck permissions and arguments, execute if permitted and return the actual result
    A completed turnReport the result without assuming every acceptance criterion was met
    A limit or an errorRecord the incomplete state, then recover or stop according to policy

    The Model Context Protocol (MCP) addresses a different problem. Without a shared interface, connecting several applications to several tools can require a custom adapter for every pair; with a shared protocol, each application and each tool implements the interface once. That reduces integration work, but authentication, permissions and failure behavior still have to be defined, and the protocol does not set goals, run loops or guarantee safe execution. MCP addresses the integration boundary; the harness determines how those capabilities are used.

    Harness Architecture and Multi-Agent Coordination

    A single model-and-tool loop is often sufficient. More complex tasks may benefit from specialized workers or independent review. In an implementer–reviewer arrangement, one worker produces code while another evaluates the artifact against requirements. A separate review context reduces the risk of reproducing the implementer’s assumptions, though it does not remove every source of error.

    Common coordination patterns include hierarchical designs, where an orchestrator assigns work to workers; peer-to-peer designs, where agents interact as equals; adversarial designs, where a generator and a critic refine each other’s output; and assembly lines, where agents run in a fixed sequence. An order-to-cash process might coordinate order capture, inventory allocation and invoicing as an assembly line with typed shared state and explicit handoffs.

    Coordination has costs. Multiple agents editing tightly coupled logic or mutable state can create conflicts and duplicated work, and token use rises quickly: Anthropic reported that its multi-agent research system used about 15 times the tokens of a chat interaction for that workload. Multi-agent design is a coordination choice, not a maturity badge. Its value should come from specialization, isolation, independent review or genuinely parallel tasks, such as researching several competitors independently.

    A Harness at Work: Building and Running a Promotion Analytics Application

    Consider an analytics team asked to build a trade-promotion performance application. It should combine point-of-sale, shipment and promotion-calendar data, estimate incremental volume for each event and let category managers review results before they are shared with a retailer. The developers supply a specification and acceptance criteria, such as lift calculated against an agreed baseline and totals that reconcile to finance figures. The coding harness exposes the repository, terminal, test suite and a sandboxed copy of the data.

    The model interprets the requirements and proposes an implementation sequence, which the team reviews before any code changes. The harness exposes only the permitted files and data, performs approved file and terminal operations, and returns test results and failure evidence. The model reads that evidence and proposes the next change, and the cycle continues until the results meet the acceptance criteria or the remaining gaps are reported.

    Each control surface plays its part. The Prompt sets the objective, Context supplies the specification and the data model, the Loop enables repeated test-and-fix cycles, and the Graph may add an independent reviewer that checks the lift logic before anything is merged.

    Coding agent versus runtime agent

    The coding agent that builds the application is not the same as an agent operating inside the finished application. The product may remain a deterministic pipeline and dashboard, include one AI-assisted step that drafts commentary on each promotion, or use a runtime agent that category managers can ask why an event underperformed. Choosing to build software with an agent does not imply that the software itself should be autonomous.

    Side-by-side comparison. The coding agent builds the application for the development team, with a harness exposing the repository, terminal, tests and sandboxed data, and produces reviewed code. The optional runtime agent operates inside the application for category managers, with a harness exposing the governed semantic model, read-only queries and a planning system behind approval. Below, three options for the finished product: a deterministic pipeline and dashboard, one AI-assisted step, or a runtime agent.
    Figure 5. The coding agent and the runtime agent need different harnesses, permissions and evidence. Building with an agent does not mean the product must be agentic.

    If the team does add a runtime agent, its harness has a different job. Return to the out-of-stock question that opened this blog post. The harness loads the category manager’s permissions, the governed definition of out-of-stock and the retailer hierarchy from the application it runs inside. It validates each query against the semantic model and runs it read-only, and it compacts earlier steps so the context holds the evidence that matters. It checks that every figure reconciles to its source before accepting a finding. An expedited replenishment recommendation remains a proposal until a planner approves it. The model reasons; the harness decides what it sees, what it may touch and when a human must step in.

    Verification, Observability and Evaluation

    A polished final answer may conceal missing steps, inappropriate tool use or unverified claims. Imagine a promotion-review agent that reports strong lift for an event but quietly used the wrong baseline weeks. The failure might stem from misunderstanding the request, an incomplete specification, lost context or a weak verification check. Evaluating only the final response is insufficient.

    Observability means using recorded evidence to understand a running system. A trace connects one execution; spans record its individual steps, including model calls, queries, validations, errors, time taken and token use. Together they show what the system actually did. Hamel Husain and Shreya Shankar’s three gulfs then help locate the cause: a comprehension gulf, where the team does not yet understand the range of real requests and outcomes; a specification gulf, where intended behavior was never expressed clearly; or a generalization gulf, where behavior that holds for familiar cases fails elsewhere. These distinctions prevent every defect from being labeled a model problem.

    From observations to evaluators

    Modern AI Fundamentals introduced evaluation as a foundational layer; here it becomes operational, through three moves: analyze, measure and improve. Reviewers first read individual traces and write specific notes, a practice called open coding. “Lift calculated against the wrong baseline weeks” is a useful note; “bad answer” is not. Related notes are then grouped into failure categories, called axial coding, each with a definition, a clear failure, a clear non-failure and a borderline example.

    A principal domain expert, someone with authority over acceptable business behavior, approves those definitions before anything is automated. In a CPG setting, that might be the revenue growth management lead who owns promotion analytics. The expert approves the rule; the coding agent can implement the checks.

    Each approved criterion then gets the narrowest check that can decide it. Deterministic code checks suit permissions, required fields, reconciliation totals and prohibited writes. Semantic criteria, such as whether a finding’s explanation is supported by the evidence, may need an LLM-as-a-Judge, but the judge must be calibrated against expert-labeled cases before its scores are trusted. Calibration looks at two kinds of error: false alarms, which waste review time, and missed failures, which leave business risk in place. Every verdict also needs a denominator: report failures against the cases actually assessed, and list the cases that could not be assessed separately.

    Eight-step evaluation loop: read traces, open coding, axial coding, expert approves criteria, build evaluators, golden set, change one thing and rerun, sample fresh traces, then repeat. A side panel asks whether each result is correct in execution, evidence and outcome. A bottom band lists the three gulfs from Hamel Husain and Shreya Shankar: comprehension, specification and generalization.
    Figure 6. Evaluation as a continuous loop for the promotion-review agent: traces become criteria, criteria become checks, and fresh traces reveal what the checks miss.

    Three collections serve different purposes. A golden regression set protects behavior already agreed. Judge-calibration examples test whether the evaluator agrees with the expert. Fresh production traces reveal what users are doing now and which failures the suite misses. A high golden-set pass rate does not establish universal reliability.

    When a fix is proposed, change one thing at a time, rerun the affected cases and the relevant older ones, and confirm the result on cases that were not used to tune it; an unchanged overall score can hide a fix in one place and a regression in another. The same discipline applies to choosing a model or a reasoning-effort setting: keep the evaluator fixed and choose the lowest-cost configuration that meets the agreed quality, response-time and permission requirements.

    Finally, evaluation should distinguish execution correctness (were tool calls, permissions and state transitions valid?), evidence correctness (were the figures grounded in the right source data and governed definitions?) and outcome correctness (did the result satisfy the actual business requirement?). A run can pass the first two and still fail the third.

    Designing for Control Before Autonomy

    Architects must decide what information the model may see, which tools it can invoke, how state persists, when execution stops, and which actions require approval. A bounded process may need only a deterministic workflow with a model call. Open-ended exploration may justify a more autonomous agent. Neither choice removes the need for validation and evidence.

    Consequential actions, such as changing a supply plan, issuing a retailer credit, modifying master data or changing production infrastructure, may require scoped permissions, confirmation, rollback and human oversight. Assess each action for reversibility and blast radius, together with the sensitivity of the data involved, and place approval gates in the harness before consequential tools run. Approving a plan at the start of a task does not automatically authorize a changed action later.

    The design question is not “How autonomous can this be?” but “What decisions should the model make, what actions should the system permit, and what evidence is needed to trust the result?”

    When the Harness Fails: Recovery Matters

    Suppose a CPG sales agent investigates a retailer stockout and proposes an expedited replenishment request. The planner approves it, and the harness sends the request to a supply-planning service, but the connection times out before the harness receives confirmation. A timeout does not mean the request failed: the action may have succeeded even though the response was lost, and blindly retrying could create a duplicate order.

    A resilient harness records an operation identifier before sending, checks the external system for the prior outcome and uses idempotent operations where supported, so that a retry with the same identifier cannot create a second order. If the status remains uncertain, it pauses and escalates rather than claiming success or repeating a consequential action.

    Flowchart: an approved expedited replenishment request is sent with an operation ID recorded in task state, then times out. The harness checks status by operation ID. If found, it records the outcome and does not resend. If not found, it retries with the same operation ID. If still uncertain, it pauses and escalates to the planner. A warning notes that blind retries can create duplicate orders.
    Figure 7. Recovering from an uncertain action: the harness checks before it acts again.

    The difference is not better prose from the model. It is explicit execution state, safe retry behavior, evidence-based verification and a defined human decision boundary.

    Five Principles for Designing an Effective Agentic Harness

    1. Specify before executing. Define intended behavior, acceptance criteria and permitted actions before delegating work.

    2. Provide relevant context, not maximum context. Retrieve and retain the evidence needed for the next decision, including governed business definitions.

    3. Separate proposals from authority. Validate tool requests and enforce permissions and approval boundaries outside the model.

    4. Make state and actions recoverable. Persist task progress and handle retries, partial failures and uncertain completion safely.

    5. Verify outcomes, not tool-call success. Compare observable execution and business evidence against explicit acceptance criteria.

    Conclusion — Intelligence Needs an Execution System

    LLMs can interpret instructions and propose increasingly sophisticated work. Turning those proposals into reliable action requires a surrounding system that supplies context, connects tools, manages state, controls execution and returns observations. The four control surfaces of Prompt, Context, Loop and Graph provide a practical way to design that system.

    The agency spectrum clarifies how much control is delegated, and the consequence of each action decides how much oversight it needs. Specification-driven development establishes intended behavior. Verification and evaluation establish whether the work achieved its goal. The future of agentic AI will not be determined by model intelligence alone. The model provides intelligence; the harness enables controlled execution; evidence establishes whether the intended outcome was achieved.

    Agentic AI is therefore not simply a more capable LLM. It is a model operating within an engineered system designed to turn intelligence into useful, controlled and trustworthy work. The harness is where intelligence meets engineering discipline.

    Further Reading

    Modern AI Fundamentals: From Models to Agentic Systems, AmitNotes

    Beyond the LLM: What It Takes to Build Enterprise-Grade Agentic AI, AmitNotes

    Six agent harness capabilities for higher model performance, NVIDIA Technical Blog

    Effective harnesses for long-running agents, Anthropic Engineering

    How we built our multi-agent research system, Anthropic Engineering

  • Modern AI Fundamentals: From Models to Agentic Systems

    Modern AI Fundamentals: From Models to Agentic Systems

    From Tokens and Transformers to Agents, Decisions and Continuous Improvement

    A seven-layer mental model for understanding how tokens, transformers, context, knowledge, tools and agents come together to turn AI intelligence into decisions and actions.

    The vocabulary around AI has expanded rapidly. We started with Machine Learning and Deep Learning, then Transformers, Foundation Models and LLMs. Today, conversations increasingly include RAG, context engineering, reasoning models, tool calling, MCP, memory, AI agents, multi-agent systems, evaluation, observability and agentic workflows.

    Individually, most of these concepts are understandable. The harder part is seeing how they fit together. Where does a Transformer fit relative to an LLM? Is RAG part of the model or the application around it? What is the difference between context, memory and state? Does giving an LLM a tool make it an agent? Where does MCP fit? And what changes when AI moves from generating an answer to pursuing a goal and taking action?

    A useful way to make sense of this landscape is to stop treating modern AI as a collection of disconnected terms and instead build a layered mental model. The framework in this article has seven layers: Data & Representation; Model; Context & Knowledge; Capabilities; Agentic; Evaluation, Observability & Control; and Decisions & Actions. The layers are not a rigid technology stack. They are a way to understand what each concept contributes and how increasingly capable AI systems are assembled.

    The model provides intelligence. The system around it makes that intelligence useful, controlled and trustworthy.

    Layer 1 — Data & Representation

    Modern AI can work with text, images, audio, video and code, but models ultimately process numerical representations. This first layer explains how real-world information is converted into a form the model can work with. For language, the journey begins with tokenization; embeddings then provide a richer numerical representation of meaning.

    1. Tokens and Tokenization

    A token is a small unit of text processed by a language model. Depending on the tokenizer, it may be a complete word, part of a word, punctuation or another symbol. Tokenization breaks text into these units and maps them to numerical IDs. Conceptually: Text → Tokens → Numeric IDs → Model. Tokens also matter at the application level because instructions, retrieved evidence, conversation history and tool results all consume context capacity.

    2. Embeddings

    An embedding represents information as a vector — a collection of numbers that captures useful aspects of meaning. The important idea is not the individual numbers but their relationships. Semantically related words, sentences or document passages can often be represented closer together mathematically. This makes embeddings important both inside models and in retrieval systems.

    3. Vector Space

    Embeddings exist in a high-dimensional vector space. A useful intuition is that similar meanings tend to occupy nearby regions. This enables semantic similarity: a question can be compared with thousands of passages and the system can retrieve information that is close in meaning even when the exact wording is different.

    Layer 2 — Model

    The Model Layer is where much of the intelligence associated with modern Generative AI is learned. Transformers process relationships among tokens, attention helps the model focus on relevant information, and foundation models provide broad capabilities that can be reused across many applications.

    1. Transformer and Attention

    The Transformer is the neural-network architecture behind most modern LLMs. One of its central mechanisms is attention, which helps the model weigh relationships among different parts of the input. At a simplified level: Input Tokens → Attention Layers → Internal Representations → Next-Token Prediction. Repeated across many layers and trained at large scale, this allows the model to learn complex patterns in language and other modalities.

    2. Foundation Model

    A foundation model is trained broadly and can support many downstream tasks rather than being designed for one narrow problem. One broadly trained model may summarize, extract, classify, answer questions, generate code or support reasoning. This is an important shift from one model for one task toward reusable intelligence that applications can adapt through context, tools and surrounding software.

    3. LLMs and Multimodal Models

    A Large Language Model, or LLM, is a large-scale foundation model primarily oriented around language. A multimodal model can work across multiple forms of information such as text, images, audio and video. These terms describe related capabilities, but the important mental-model point is that the model provides general intelligence; it does not by itself know the current business situation, the latest enterprise data or what action is permitted.

    Layer 3 — Context & Knowledge

    A capable model is only part of a useful AI application. The model also needs the right information for the task at the right time. This layer brings together the user request, instructions, history, current state, retrieved evidence and governed knowledge that shape what the model can do in a particular interaction.

    1. Prompt

    A prompt is the instruction or input given to the model. Prompt engineering focuses on expressing the task, constraints and expected response clearly. In a production application, however, the prompt is only one component of the model’s working information.

    2. Context Window

    The context window is the bounded amount of information available to the model in an interaction. It can include system instructions, the user request, retrieved evidence, conversation history, tool descriptions, tool results and current task state. More context is not automatically better: irrelevant or stale information can consume capacity and make important evidence harder to use.

    3. Context Engineering

    Context engineering is the deliberate selection and organization of what the model needs right now. Prompt engineering asks, “What should I ask the model?” Context engineering asks the broader question, “What should the model know at this point in the task?” In enterprise AI, this can include governed definitions, relevant documents, user or business context, current state and the tools available to the application.

    4. RAG — Retrieval-Augmented Generation

    RAG retrieves relevant information at runtime and supplies it to the model as evidence. A simple flow is Question → Retrieve Relevant Information → Add Evidence to Context → Generate Response. This is useful when knowledge changes frequently because the underlying source can be updated without retraining the model.

    5. Vector Search

    Vector search uses embeddings to find semantically similar information. Document passages and the user’s query are represented numerically and compared in vector space. This allows retrieval based on meaning rather than relying only on exact keyword matches.

    6. Knowledge Graphs and Semantic Models

    Not every knowledge problem is best solved by retrieving text. Knowledge graphs represent entities and their relationships explicitly, while semantic models encode governed business meaning such as measures, definitions and hierarchies. These approaches can complement one another: RAG retrieves evidence, vector search finds semantic similarity, knowledge graphs capture relationships and semantic models provide consistent business meaning.

    Layer 4 — Capabilities

    The model may understand and reason about information, but real work often requires capabilities outside the model. The system may need to query a database, search, execute code, read files, call an API, remember something for later or maintain progress across a workflow. The Capability Layer extends what the model knows into what the overall application can do.

    1. Tools

    A tool is an external capability available to the AI application. Examples include APIs, databases, search, files, calculators, code execution and enterprise systems. Tools let the system obtain fresh information or cause an external operation rather than relying only on what is already present in the model or context.

    2. Tool Calling

    The model typically does not execute an external system directly. It requests a tool and supplies structured arguments. The surrounding runtime or harness validates that request, checks permissions, executes the allowed operation and returns the result. The mental model is Model → Request → Harness → Tool → Result → Model. The model proposes; the surrounding software validates and executes.

    3. MCP — Model Context Protocol

    As applications connect to more tools and resources, custom point-to-point integrations become difficult to reuse. Model Context Protocol, or MCP, provides a standard interface through which AI applications can connect to tools and resources. MCP is therefore best understood as an interoperability mechanism. It can make capabilities easier to expose and reuse, but it does not by itself make a system agentic.

    4. Context, Memory and State

    These terms are related but should not be collapsed into one idea. Context is what the model can see now. Memory is information intentionally retained for later use. State records where the system currently is in a task or workflow. A useful shorthand is Now → Context; Later → Memory; Where → State. Durable state should live in application storage rather than treating the model’s context window as a database.

    5. Fine-Tuning

    Fine-tuning adapts model behavior through additional training. It solves a different problem from RAG: RAG changes the information available to the model at runtime, while fine-tuning changes learned model behavior. This distinction helps avoid using model adaptation when the actual need is simply fresh or domain-specific evidence.

    6. Reasoning Models

    Reasoning-oriented models are optimized for tasks that benefit from multi-step problem solving, such as decomposing a problem, connecting evidence, comparing alternatives or planning a next step. Reasoning can improve how a problem is worked through, but reasoning alone does not create agency. Agency also requires a system that can act, observe results, maintain state and decide whether to continue.

    Layer 5 — Agentic

    The Agentic Layer marks the transition from systems that primarily generate responses to systems that can pursue goals across multiple steps. The architectural change is not simply a more powerful model. It is the combination of a model with context, tools, state and an iterative execution loop.

    1. Agent

    An AI agent, in the course framing, is a language-model-based system in which the model selects steps toward a goal while surrounding software executes permitted tools and returns their results. The system also uses task state — information retained about the task and its progress — to decide what to do next. The amount of decision-making delegated to the model can vary substantially. A useful mental model is therefore not simply “LLM + tools,” but Model + Context + Tools + Task State + Harness + Iterative Execution.

    2. Agentic Loop

    The course defines the agentic loop through five functions: Perceive → Reason → Act → Observe → Verify, repeating relevant steps when work remains. Perceive receives the goal and relevant task state. Reason chooses the next step. Act occurs when the harness executes a permitted tool request. Observe receives the tool result. Verify compares the available evidence with the acceptance criteria. If work remains, the loop repeats; otherwise the system reports the result or the reason for stopping. In the infographic, “Iterate” makes this repetition explicit. Importantly, repeated actions do not prove success — verification requires evidence against defined acceptance criteria.

    3. Agency Levels

    Agency is better understood as a spectrum of delegated control. The course uses four teaching categories: None — a fixed prompt and one model call without tools or branching; Augmented Interaction (Level 1) — retrieval, tools or other capabilities inside a bounded procedure; Workflow (Level 2) — an engineer-defined coordination scheme combining model calls and tools while delegating selected decisions; and Autonomous Agent (Level 3) — the model selects successive steps and tools at runtime within the harness’s permissions and limits. The infographic uses “L0 Fixed model call” as a compact visual shorthand for the course’s “None” category. The key design question remains: Who decides what happens next?

    4. Agentic Workflow

    An agentic workflow combines model calls, tools and delegated decisions inside a coordination structure largely defined by the engineer. This can provide useful flexibility while keeping the process bounded, testable and easier to govern. For many enterprise use cases, this can be preferable to maximizing autonomy.

    5. Autonomous Agent

    An autonomous agent selects steps and tools dynamically at runtime. Autonomy does not mean unrestricted freedom: permissions, tool boundaries, budgets, verification rules and stopping conditions still belong to the surrounding system. More autonomy is useful only when the task benefits from it and the additional decisions can be evaluated.

    6. Harness

    The agentic harness is the software around the model that supplies context and tools, executes permitted requests, and manages continuation or stopping. It can also retain task state between model calls. In practical systems, the harness is therefore the control boundary between model proposals and real execution: the model proposes steps; the harness enforces the available execution rules. This is why the same underlying model can behave very differently depending on the harness in which it operates.

    7. Multi-Agent Systems

    A multi-agent system uses several agents and distributes work or autonomy across them. Coordination may follow fixed rules or allow dynamic decisions; importantly, agent count is a separate design choice from the level of autonomy. The value may come from specialization, isolation, parallelism or independent review. More agents do not automatically make a system better: tightly coupled agents sharing changing state can increase coordination problems. Multi-agent design is therefore a decomposition and coordination choice, not a maturity badge.

    Layer 6 — Evaluation, Observability & Control

    Once AI systems use tools and pursue goals, evaluating only the final answer is no longer enough. We need evidence of what happened during execution, explicit criteria for judging behavior, a way to diagnose failures, regression tests for agreed behavior and monitoring after deployment. Week 5 of the IISc course frames this as a continuous engineering loop rather than a final quality gate.

    1. Traces and Spans — What Happened?

    A trace is the end-to-end record of one request through the system; spans represent individual steps within that trace. Together they can show model calls, tool requests, tool results, routing decisions, latency, validation outcomes and errors. This makes the system observable at the process level rather than judging only the final response.

    2. Evaluation — How Well Did It Work?

    Evaluation converts desired behavior into explicit criteria and checks. Some criteria are deterministic and can be evaluated in code; others require semantic judgement. For agentic systems, evaluation should consider both output quality and process quality: whether the right tools were used, arguments were appropriate, permissions were respected and the claimed result was actually achieved.

    3. Diagnose — Why Did It Fail?

    The Week 5 material introduces three useful gulfs for diagnosis. The comprehension gulf is the gap between the developer and the data or real behavior. The specification gulf is the gap between the intended behavior and what was actually specified. The generalization gulf is the gap between tested examples and the broader range of real requests. This framing helps teams locate the source of failure before deciding that the model itself needs to change.

    4. Evaluators and Human Judgement

    Human judgement is often where evaluation criteria begin. Experts review real traces, identify acceptable and unacceptable behavior, and turn those observations into explicit checks. Deterministic checks should be used where code can decide reliably. LLM-as-a-Judge becomes useful for semantic criteria that cannot be captured easily in code, but the judge itself should be validated against expert-reviewed examples before it is trusted at scale.

    5. Improve — Fix the Responsible Layer

    Once a failure is understood, improvement should target the responsible layer. The right fix may be a clearer specification, better context, a different prompt, stronger retrieval, improved tool definitions, application logic, permissions, data or model choice. Treating every failure as a prompt problem or model problem can hide the real architectural cause.

    6. Golden Sets and Regression Testing

    A golden set is a curated collection of approved cases with expected behavior. It should include core functionality, important edge cases and past failures that must not return. Golden sets are valuable regression alarms, but a high pass rate does not prove quality across every user or production situation. They protect known behavior; they do not eliminate unknown failure modes.

    7. Monitor in Production and Improve Continuously

    Evaluation continues after deployment. Production traces, user feedback and new failure patterns provide fresh evidence that can update criteria, evaluators and the golden set. The lifecycle therefore becomes Traces → Evaluate → Diagnose → Improve → Regression Test → Monitor → New Evidence → Improve Again. This is the feedback loop that turns evaluation into continuous system improvement.

    8. Guardrails and Human Oversight

    Guardrails and human oversight span the entire lifecycle rather than appearing as one final step. Permissions, validation, budgets, approval gates, rollback strategies and escalation paths constrain what the system may do. Human review becomes increasingly important for consequential or difficult-to-reverse actions. The level of control should reflect the consequence of the action, not simply the technical capability of the model.

    Layer 7 — Decisions & Actions

    The final layer connects AI to real-world outcomes. In enterprise settings, the goal is rarely to generate more content for its own sake. The value comes from turning analysis and evidence into better decisions, appropriate actions and measurable outcomes — and then feeding what happened back into the system.

    1. Evidence

    Evidence is the information on which a decision is based. It may come from model analysis, retrieved facts, enterprise data, analytical models or tool results. Grounding decisions in evidence improves explainability and creates something that can be reviewed or verified.

    2. Decision

    A decision converts evidence into a choice. It may be a recommendation, an automated selection, a human approval or a combination of these. The important point is that the decision should be connected to the evidence and to the level of authority the AI system has been given.

    3. Action

    An action changes something in the real world or another system: updating a record, triggering a workflow, sending a notification, creating a ticket or executing another permitted operation. This is where tool-enabled and agentic systems move beyond content generation.

    4. Outcome

    An outcome is the measurable result of the decision and action. Depending on the use case, it could be faster resolution, better decision quality, improved customer experience, reduced cost, higher revenue or lower risk. Outcomes also provide new evidence for evaluation, closing the feedback loop.

    Putting the Seven Layers Together

    Once the layers are connected, the terminology becomes easier to place. Tokens and embeddings explain representation. Transformers, attention and foundation models provide the core intelligence. Context engineering, RAG, vector search, knowledge graphs and semantic models bring the right knowledge into the interaction. Tools, MCP, memory, state and reasoning extend what the application can do. Agentic loops, workflows, harnesses and multi-agent systems allow the system to pursue goals. Evaluation, observability, guardrails and human oversight make that behavior measurable and controlled. Decisions, actions and outcomes connect the technology to the real world.

    The important architectural idea is that these layers interact. An agent can fail because retrieval supplied the wrong evidence, because a tool contract was ambiguous, because state was lost, because the specification was incomplete or because the model made a poor decision. Continuous evaluation provides the evidence needed to improve the correct layer rather than simply changing the model.

    A System View: From Intelligence to Controlled Action

    The seven layers can also be compressed into four architectural bands. This is an explanatory synthesis used in this article — not a separate IISc course taxonomy — and it helps show why agentic AI is a system architecture rather than simply a new model category.

    1. Intelligence

    Tokens → Embeddings → Transformers → Foundation Models. This is where information is represented and general model capability is learned.

    2. Grounding & Augmentation

    Prompt + Context + Retrieved Knowledge + Reasoning + Tools/MCP. This gives the model task-specific evidence and external capabilities.

    3. Agency & Orchestration

    Harness + Task State + Memory + Agentic Loop + Workflow/Agent Coordination. This determines how permitted work continues across steps and who controls what happens next.

    4. Trusted Decisions & Actions

    Evaluation + Observability + Guardrails + Human Oversight → Evidence → Decision → Action → Outcome. This connects AI behavior to controlled execution and measurable results.

    A Simpler Capability Progression

    The seven-layer model explains the architecture. A second, simpler view helps explain how AI capabilities build on one another:

    • Generative AI — Model + Prompt → generates content such as answers, plans or analyses.
    • Grounded AI — Generative AI + Context + Retrieved Knowledge → uses relevant evidence.
    • Augmented AI — Grounded AI + Tools → reaches external capabilities and systems.
    • Agentic AI — Augmented AI + Harness + Task State + Iterative Loop → pursues goals through controlled, multi-step execution.
    • Governed Agentic AI — Agentic AI + Evaluation + Guardrails + Human Oversight → controlled and trustworthy execution.
    • Decision Systems — Evidence → Decision → Action → Outcome, with feedback flowing back into every layer.

    Generative AI creates. Grounded AI uses knowledge. Augmented AI reaches tools. Agentic AI pursues goals. Governed Agentic AI adds control. Decision systems connect all of this to outcomes.

    From Intelligence to Continuous Improvement

    The evolution of modern AI is often described mainly through more capable models. That is only part of the story. The larger architectural change is happening around the model. We give models context, connect them to knowledge and tools, maintain memory and durable task state, place the model inside a harness that controls execution, and use iterative loops to pursue goals. We then surround those loops with evaluation, observability, permissions, guardrails and human oversight.

    The addition of real-world outcomes changes the picture again. Once an AI system takes action, the result of that action becomes new evidence. Production traces, user feedback, exceptions and business outcomes can flow back into evaluation. Evaluation can refine criteria, expose new failure categories, expand the golden set and guide improvements to prompts, context, tools, data, orchestration or models.

    Data → Representation → Model → Context & Knowledge → Capabilities → Agentic → Evaluation, Observability & Control → Decisions & Actions → Outcomes → Continuous Improvement

    This is why modern AI is no longer only about what a model can generate. It is about how intelligence is represented, grounded, extended, orchestrated, evaluated and connected to action — and how evidence from those actions is used to make the system better over time.

    The model provides intelligence. The system around it makes that intelligence useful, controlled and trustworthy.

  • Beyond the LLM: What It Takes to Build Enterprise-Grade Agentic AI

    Beyond the LLM: What It Takes to Build Enterprise-Grade Agentic AI

    From probabilistic intelligence to governed, contexåt-aware and auditable enterprise workflows

    Generative AI has made it remarkably easy to build impressive prototypes. Give an LLM a document, connect it to enterprise data, add a few tools and agents, and within days you can demonstrate something that looks intelligent.

    But building an AI system that an enterprise can actually trust is a very different challenge.

    In enterprise environments, generating a good answer is only part of the equation. The system must understand business context, operate within defined controls, validate critical outputs, recognize uncertainty, involve humans when necessary, and provide evidence of how a decision was reached.

    This became particularly clear while building an Invoice Intelligence Agent — a governed, multi-agent workflow designed to process invoices through multimodal extraction, validation, vendor verification, safety controls, human review and auditability.

    The use case is invoice processing. But the architecture pattern is much broader.

    It applies to claims, procurement, finance operations, compliance, customer operations and many other enterprise processes where AI is moving from generating information to participating in decisions and actions.


    The LLM Is Not the Enterprise AI System

    One design principle became fundamental:

    Use AI for what requires intelligence. Use deterministic systems for what requires certainty.

    A vision-language model is very good at interpreting an invoice it has never seen before — understanding an unfamiliar layout, identifying a vendor, reading line items and converting unstructured information into structured data.

    But should we ask an LLM whether:

    Quantity × Unit Price = Line Total?

    Probably not.

    Traditional code can calculate that deterministically.

    The same principle applies elsewhere. AI may help identify a vendor from noisy or inconsistent information, but tax IDs, currencies and bank details should ultimately be verified against trusted enterprise data.

    This creates an important separation:

    LLMs interpret. Deterministic systems verify. Enterprise context grounds. Agentic workflows decide.

    And that leads to a broader architecture pattern.


    An 8-Step Pattern for Enterprise Agentic AI

    Input → Safety → AI → Validation → Enterprise Context → Decision → Human / Action → Audit

    This is a simple way to think about the layers required around an LLM when moving from an AI prototype toward an enterprise capability.

    01 — Input

    Enterprise AI starts with real-world inputs — documents, transactions, images, conversations, events or business data.

    These inputs are rarely perfect. They can be incomplete, inconsistent, noisy or potentially malicious.

    Before asking what AI can do with the information, we first need to establish what has entered the system and whether it can be trusted.

    02 — Safety

    As AI becomes connected to business processes, external content should be treated as untrusted by default.

    In the Invoice Intelligence Agent, documents are screened before the extraction model processes them. The workflow includes controls designed to identify suspicious embedded instructions and potential prompt-injection patterns.

    There is also an output safety layer before information is released downstream.

    The broader principle is important:

    AI safety cannot simply be another instruction inside the prompt. It needs to be part of the system architecture.

    03 — AI

    This is where probabilistic intelligence adds significant value.

    A vision-capable model can understand variable invoice layouts and extract structured information such as vendor details, dates, line items, taxes and totals.

    This is precisely where GenAI is powerful — understanding information whose structure cannot easily be predetermined.

    But the model output should be treated as evidence, not automatically as truth.

    04 — Validation

    Once something can be proven deterministically, it should be. Extracted information therefore goes through independent checks for required fields, dates, line-item arithmetic, subtotals, taxes and totals.

    These validations don’t require an LLM.

    This separation is critical when designing enterprise AI:

    Use probabilistic intelligence for interpretation and deterministic controls for certainty.

    05 — Enterprise Context

    This may be one of the most important layers for scaling enterprise AI.

    A model can understand an invoice. But it does not inherently know whether the vendor is legitimate, which master record is authoritative, whether bank details are correct, or which enterprise policy should apply.

    That requires enterprise context.

    In the Invoice Intelligence Agent, vendor verification combines retrieval with governed vendor information and deterministic checks such as tax ID, currency and bank details.

    At enterprise scale, that context becomes much richer:

    Master Data • Business Semantics • Policies • Historical Transactions • Domain Knowledge • Permissions • Enterprise Systems

    This is why I increasingly see context engineering as an enterprise capability, not simply an LLM engineering technique.

    Models will continue to improve.

    But the quality of enterprise AI will increasingly depend on the quality of the business context surrounding those models.

    06 — Decision

    This is where agentic AI becomes particularly interesting. Agentic architecture is not about creating as many agents as possible. It is about orchestrating intelligence, context, evidence and controls toward an outcome. The workflow maintains state and determines what happens next based on the evidence collected.

    • A validated invoice from a verified vendor can proceed.
    • A validation issue may trigger a bounded correction.
    • An unknown or mismatched vendor can trigger human review.
    • A suspicious document can be blocked.

    The intelligence therefore lies not only in what the model generates, but also in how the system determines the next best action.

    07 — Human / Action

    Human-in-the-loop should not mean putting a human behind every AI decision. That simply recreates the manual process with AI sitting in front of it. Instead, human involvement should be risk-based and exception-driven. High-confidence and independently validated cases can progress automatically.

    Uncertain vendor identity, conflicting business information, unresolved validation failures or safety concerns should trigger human review.The goal is not maximum autonomy.

    The goal is appropriate autonomy.

    08 — Audit

    Finally, enterprise AI needs a record of what happened.

    For every transaction, we should be able to understand what the AI extracted, what was validated, what enterprise context was retrieved, what corrections were made, why something was escalated and what final action was taken.

    This becomes increasingly important as AI starts participating in business processes rather than simply answering questions.

    Auditability should not be added after an AI solution reaches production. It should be designed into the architecture from day one.


    Evaluation Has to Move Beyond Model Accuracy

    Another important lesson is that evaluating enterprise AI cannot stop at:

    “How accurate is the model?”

    Model accuracy matters, but enterprise systems require a broader set of measures.For the Invoice Intelligence Agent, the evaluation framework considers dimensions such as:

    • First-pass extraction accuracy
    • Post-correction accuracy
    • Correction and human-review rates
    • Safety precision and recall
    • Vendor retrieval performance
    • Latency
    • Cost per processing run

    The more important enterprise questions become:

    • How often can the process operate autonomously?
    • How often does it require human intervention?
    • How effectively does it detect risk?
    • How reliably is it grounded in enterprise data?
    • What does each successful transaction cost?
    • Can we explain why the system made a decision?

    These are system-level questions, not simply model-level metrics.


    From AI Prototypes to Enterprise Decision Systems

    The biggest takeaway for me from building this architecture is that the sophistication of the model is only one dimension of enterprise AI maturity. As organizations move from copilots and conversational AI toward agents and decision intelligence, the architecture surrounding the model becomes increasingly important.

    Context. Controls. Safety. Evaluation. Orchestration. Observability. Human Judgment. Governance.

    The LLM provides intelligence.

    The surrounding system creates trust.

    And ultimately, that is what turns an impressive AI prototype into an enterprise capability that can participate safely and meaningfully in business decisions at scale.


    About the Project

    The Invoice Intelligence Agent was developed as part of my capstone project IISc Advanced Certification Programme in Agentic and Generative AI.

    The implementation explores a governed agentic architecture combining multimodal AI, LangGraph orchestration, deterministic validation, RAG-based vendor verification, layered safety controls, bounded correction, human-in-the-loop routing, evaluation and persistent auditability.

    While invoice processing was the use case, the broader architecture can be applied across document intelligence, claims, procurement, finance, compliance and other enterprise workflows.

  • Generative AI: A Probabilistic Foundation for Intelligent Systems

    Generative AI: A Probabilistic Foundation for Intelligent Systems

    From business productivity to decision intelligence — how foundation models, transformers, agents, and production AI systems are reshaping work

    Every organization is under pressure to move faster: faster decisions, faster insights, faster product innovation, faster customer response, and faster execution. Yet most enterprise knowledge still sits across reports, documents, dashboards, emails, codebases, policies, and systems that people must manually search, interpret, and connect.

    Generative AI changes this equation.

    It gives organizations a new way to interact with knowledge. Instead of only searching for information, users can ask questions. Instead of only reading reports, they can receive summaries, explanations, and recommendations. Instead of manually writing code, documents, or analysis, they can collaborate with AI systems that generate, refine, and act. This is why Generative AI is not just a technology trend. It is becoming a new productivity and decision-intelligence layer across the enterprise.

    For business leaders, the promise is clear: reduce time spent finding information, improve the quality of decisions, automate repetitive knowledge work, and create more personalized experiences for customers and employees. For technology leaders, the challenge is equally clear: understand how these systems work, how to adapt them to enterprise knowledge, how to deploy them safely, and how to govern them responsibly.

    At the foundation of this shift is a powerful technical idea: instead of programming every rule, we train large models to learn probability distributions over massive datasets. These models generate new outputs by estimating what is most likely, useful, or contextually appropriate given an input.

    A useful way to understand the full journey is this:

    Generative AI begins with probabilistic language modeling, scales into foundation models, is powered by transformers, adapted through prompting, RAG, and fine-tuning, extended through agents, operationalized through LLMOps, and advanced through frontier innovation.

    This article explains that journey from both perspectives: the business outcomes Generative AI enables and the technical foundations that make those outcomes possible.

    What is Generative AI?

    Generative AI refers to artificial intelligence systems that create new content by learning patterns from existing data. This content can include text, images, code, audio, video, presentations, reports, molecules, simulations, or structured business outputs. Unlike traditional discriminative AI, which predicts labels or categories, generative AI produces new samples.

    A discriminative AI model might answer: Is this transaction fraudulent — yes or no?

    A generative AI model might answer: Draft a customer response explaining why the transaction was flagged, summarize the risk indicators, and recommend the next action. This distinction matters. Traditional AI is mostly about classification, prediction, and optimization. Generative AI is about creation, synthesis, reasoning, interaction, and increasingly action.

    A simple way to define it is: Generative AI learns the structure of data and uses that learning to generate new, contextually meaningful outputs.

    The explosion of Generative AI became visible through tools such as ChatGPT, Claude, Gemini, Midjourney, DALL·E, GitHub Copilot, Perplexity, and many others. But the foundation behind these tools comes from decades of progress in neural networks, language modeling, representation learning, attention mechanisms, and large-scale self-supervised training. Today, Generative AI powers writing assistants, enterprise search, code generation, customer support agents, document intelligence, research assistants, multimodal copilots, business intelligence assistants, and autonomous AI agents.

    Generative AI vs. Discriminative AI


    How Does It Work? The Core Idea

    At the heart of every generative AI system is a model that has learned the statistical patterns of human language (or images, or code) from an enormous dataset. The two most important concepts to understand are:

    Language Models and Next-Token Prediction

    The most widely used Generative AI systems today are large language models, or LLMs. A language model is trained to predict the next token in a sequence. A token may be a word, part of a word, punctuation mark, number, symbol, or code fragment.

    For example, given the phrase: The quarterly sales declined because

    A language model may assign probabilities to possible next tokens such as: competition, demand, pricing, inventory, promotion, distribution ? The model does not look up the answer in a database. It estimates probabilities based on patterns learned during training.

    Formally, a language model estimates:

    P(wₜ | w₁, w₂, …, wₜ₋₁)

    In plain terms: given everything that came before, what’s the probability of the next token?

    A full sequence is just this calculation repeated and chained together, using the chain rule of probability:

    P(w₁, w₂, …, wₙ) = ∏ₜ₌₁ⁿ P(wₜ | w₁, …, wₜ₋₁)

    This process is called autoregressive generation: the model produces one token at a time, and each new token immediately becomes part of the context used to predict the next one.

    It sounds almost too simple to explain how these systems write code, reason through problems, or hold a conversation. But repeated across trillions of tokens and tuned across billions of parameters, next-token prediction forces the model to internalize grammar, facts, style, reasoning patterns, code syntax, domain concepts, and conversational structure — all without ever being explicitly taught any of it.

    That’s the underlying power of self-supervised learning: the data itself becomes the training signal.

    From Language Models to Foundation Models

    A foundation model is a large-scale neural network trained on broad, diverse data using self-supervised learning. It produces a general-purpose representation that can be adapted to many downstream tasks with minimal additional training.

    This is a major shift from the earlier AI paradigm. In the past, teams trained separate models for separate tasks: one model for sentiment analysis, another for translation, another for classification, another for entity extraction, and another for summarization.

    Foundation models changed this pattern. Instead of training a separate model for every task, we pre-train one large model on broad data and then adapt it to many tasks using prompting, retrieval, fine-tuning, tool use, or agentic workflows.

    This is why they are called foundation models. They are not final applications by themselves. They are base capabilities on which many intelligent systems can be built.

    The Transformer Architecture

    If language models explain what Generative AI is trying to do — predict and generate the next token — the Transformer explains how modern AI systems do this at scale. Before transformers, most sequence models processed text step by step. Recurrent Neural Networks and LSTMs read one token after another, carrying information forward through a hidden state. This worked for short sequences, but it created two major limitations: training was slow, and long-range context was difficult to preserve.

    The Transformer changed this by replacing sequential processing with attention. Instead of reading words one by one, a transformer looks at the full sequence and learns which tokens should influence each other. This allows the model to connect ideas across long distances — a pronoun with its subject, a business metric with its driver, a function call with its definition, or a question with the most relevant context in a document.

    This is why the 2017 paper Attention Is All You Need became such a turning point. It introduced an architecture that could scale with data, compute, and model size — and that architecture became the foundation for GPT, Claude, Gemini, Llama, Mistral, BERT, T5, and many other modern AI systems.

    A simple way to understand the transformer pipeline is:

    This is why Generative AI feels conversational and creative, but underneath it remains probabilistic. It isn’t retrieving a fixed answer — it’s generating the next most appropriate token based on everything it has learned and everything provided in the current context.

    The transformer is therefore the bridge between probability and intelligence-like behavior. It gives foundation models three powerful capabilities:

    • Context awareness — each token can relate to every other relevant token.
    • Parallel processing — the model trains efficiently on massive datasets.
    • Scalability — larger models, more data, and more compute keep improving capability.

    This is why every major frontier model today is built on transformer principles. What differs across GPT, Claude, Gemini, Llama, and Mistral is not the architectural family, but the training data, model size, alignment strategy, context length, inference optimization, safety design, and product integration.

    For business leaders, the practical takeaway is simple: the transformer is not just a technical architecture — it is the engine that turns data, language, and context into intelligent interaction. It’s the reason a model can summarize a report, explain a KPI movement, generate code, answer questions from enterprise documents, reason over a conversation, and power AI agents that use tools.

    Understanding the transformer helps us move beyond using Generative AI as a black box. It explains why prompting matters, why context matters, why RAG works, why hallucinations happen, and why production AI needs careful design.

    How Generative AI Produces Output

    After the transformer processes the input, the model produces a probability distribution over its entire vocabulary — in simple terms, it calculates which token is most likely to come next. This distribution is created using a function called softmax, which converts the model’s raw scores into probabilities. Every candidate token gets a probability score, and the model then selects or samples from that distribution.

    But the final output isn’t just about probabilities — it’s shaped by decoding parameters that control how the model picks from the distribution:

    • Temperature — Controls how predictable or creative output is. Low = focused and deterministic; high = more creative, more variable.
    • Top-k sampling — Limits choices to the k most likely next tokens, preventing very unlikely words while allowing variation.
    • Top-p (nucleus) sampling — Selects from the smallest group of tokens whose combined probability reaches a threshold — flexibility within a likely set.
    • Maximum tokens — Caps response length, controlling output size, cost, and response time.
    • Stop sequences — Tell the model exactly when to stop generating — useful for fixed formats or precise endpoints.
    • Frequency penalty — Reduces repetition of words and phrases already used.
    • Presence penalty — Encourages introducing new ideas and terms rather than staying close to what’s already been generated.

    This is why Generative AI is fundamentally probabilistic. The same prompt can produce slightly different answers depending on model settings, context, and sampling approach. The model isn’t executing fixed logic — it’s generating from a learned probability distribution shaped by training data, prompt context, and decoding choices.

    The Generative AI Capability Stack

    Generative AI is not a single technology. It’s a layered capability stack — starting with foundation models and extending up through applications, agents, production systems, and frontier innovation. A simple way to understand the journey: foundation models provide the capability, transformers provide the architecture, adaptation techniques shape the behavior, applications and agents create user value, LLMOps makes the system production-ready, and innovation creates the next generation of AI capabilities.

    • Level 1: Foundation Models -> The base layer — large pre-trained models like GPT, Claude, Gemini, Llama, and Mistral that learn broad patterns from massive datasets. Their power lies in generality: one model can summarize, translate, write code, answer questions, reason over documents, and support countless downstream tasks.
    • Level 2: Model Adaptation -> A foundation model is powerful, but most real-world use cases need specialization — aligning the model to a specific task, domain, tone, or knowledge base. The three common strategies: prompting changes the instruction, RAG changes the context, and fine-tuning changes the model’s behavior.
    • Level 3: Applications and Agents -> Here models become usable products — chatbots, copilots, coding assistants, enterprise search, document intelligence, and BI assistants. Agentic AI extends this further: agents don’t just answer questions, they reason, use tools, observe results, and take actions across multi-step workflows.
    • Level 4: Integration and LLMOps -> A working prototype is not a production system. Production GenAI needs reliability, monitoring, cost control, latency management, safety guardrails, evaluation, and governance. LLMOps ensures AI systems are not only intelligent, but scalable, secure, measurable, and trustworthy.
    • Level 5: Innovation -> The frontier — pre-training new foundation models, designing better architectures, building scientific AI systems, and developing autonomous research agents. Innovations here become the foundation for the next wave of applications.

    The key takeaway: Generative AI should be understood as an end-to-end system, not just a chatbot interface. Real value comes when foundation models are adapted, integrated, governed, and applied to meaningful business and human problems.

    Key Technologies at a Glance

    Generative AI is powered by a combination of models, architectures, adaptation techniques, and production engineering practices. Each technology plays a different role in moving from raw model capability to real-world intelligent systems.

    1. Large Language Models : LLMs, are foundation models trained on massive volumes of text, code, and other data. They generate responses by predicting the next token based on the context provided. LLMs are the core engine behind tools such as ChatGPT, Claude, Gemini, Copilot, and many enterprise AI assistants.
    2. Transformers – Are the architecture behind most modern Generative AI systems. They use attention mechanisms to understand relationships between tokens across a sequence. This is what allows models to connect context, understand dependencies, summarize long documents, generate code, and reason across conversations.
    3. Embeddings – Convert tokens, documents, images, or other data into numerical vectors. These vectors help models represent meaning in a mathematical space. Embeddings are also the foundation for semantic search and RAG, where user questions are matched with the most relevant documents or knowledge chunks.
    4. Prompt Engineering – Is the practice of guiding model behavior through clear instructions, examples, roles, and constraints. It is often the fastest way to improve output quality without changing the model.A good prompt shapes the context, clarifies the task, and helps the model generate more useful, structured, and relevant responses.
    5. Retrieval-Augmented Generation – RAG, connects the model to external knowledge before it generates an answer. Instead of relying only on what the model learned during training, RAG retrieves relevant information from documents, databases, or enterprise knowledge systems. This makes responses more grounded, current, and useful for business scenarios where accuracy and source context matter.
    6. Fine-Tuning – Adapts a pre-trained model by training it further on domain-specific examples. This helps the model learn a specific tone, format, vocabulary, or task behavior.Techniques such as LoRA and QLoRA make fine-tuning more practical by updating only a small set of parameters instead of retraining the full model.
    7. Agentic AI – Extends Generative AI from answering questions to taking actions. An agent can reason through a goal, call tools, observe results, and continue working across multiple steps.This is the shift from simple chatbots to AI systems that can search, analyze, write code, query databases, create reports, and support real workflows.
    8. Multimodal AI – Multimodal AI systems can work across text, images, audio, video, code, charts, and documents. They allow users to interact with AI in a more natural way, using the same types of information humans use every day.This is important because real-world work is not only text-based. Business users often think through dashboards, presentations, spreadsheets, diagrams, screenshots, and conversations.
    9. LLMOps – LLMOps is the discipline of deploying, monitoring, evaluating, and governing Generative AI systems in production. It includes cost control, latency monitoring, model routing, prompt versioning, safety guardrails, and quality evaluation. Without LLMOps, a promising AI prototype may fail when exposed to real users, real data, changing requirements, and enterprise-scale usage.
    10. Frontier Innovation – Frontier innovation focuses on creating the next generation of AI capabilities. This includes pre-training new foundation models, improving transformer architectures, building scientific AI systems, and developing autonomous research agents.This is where Generative AI moves beyond productivity improvement and starts contributing to new forms of discovery, design, and knowledge creation.

    Together, these technologies form the operating system of modern Generative AI. The model provides capability, the architecture provides intelligence-like processing, adaptation makes it useful, agents make it actionable, and LLMOps makes it reliable.

    The Major Generative AI Model Families

    The Generative AI landscape is changing very quickly. New models ship every few months, and competition is no longer about who has the largest model. The market is moving toward a portfolio of models optimized for different needs: deep reasoning, coding, multimodal understanding, enterprise workflows, low-cost inference, long-context processing, and agentic task execution. A simple way to understand the current landscape is to group models by provider and strength:

    Model FamilyProviderKnown forTypical use cases
    GPTOpenAIStrong general intelligence, reasoning, coding, tool use, and multimodal capability. The GPT-5.6 family spans Sol, Terra, and Luna variants across cost-performance tiers.ChatGPT, enterprise copilots, coding, analysis, agents, multimodal apps
    ClaudeAnthropicWriting quality, long-form reasoning, coding, safety-focused design, and enterprise-grade assistant behavior — spanning Fable 5, Opus 4.8, Sonnet 4.6, and Haiku 4.5 across intelligence, speed, and cost.Research, writing, coding, enterprise assistants, long-context analysis, agentic workflows
    GeminiGoogle DeepMindNative multimodality, strong reasoning, and deep Google ecosystem integration — Pro tiers for complex reasoning, Flash/Flash-Lite for speed and cost.Multimodal search, coding, document analysis, voice agents, Workspace/Cloud AI
    Llama / Meta AIMetaThe open-weight ecosystem that accelerated the open-model movement — developer adoption, fine-tuning, self-hosted deployment.Open experimentation, enterprise self-hosting, fine-tuning, private deployments
    MistralMistral AIEfficient open and commercial models, strong European ecosystem — coding (Devstral), audio (Voxtral), OCR, and deployable enterprise models across Small/Medium/Large tiers.Enterprise AI, coding, document AI, multilingual workflows, cost-efficient inference
    DeepSeekDeepSeek AICost-efficient reasoning and coding, strong open-model influence, efficient architectures — V4 Flash and V4 Pro at disruptive price points.Reasoning, coding, math, cost-sensitive deployment, open-model research
    GrokxAIReal-time web/X-connected assistant experience, coding, tool use, configurable reasoning — Grok 4.5 as the flagship.Coding, real-time assistance, tool calling, business agents
    Command / Aya / EmbedCohereEnterprise-focused: RAG, tool use, multilingual generation, embeddings, private deployment — Command A+ for vision/reasoning/agents, Embed v4 for text and image embeddings.Enterprise RAG, semantic search, multilingual assistants, regulated industries
    QwenAlibaba CloudStrong open and proprietary family — multilingual, coding, vision, agentic; dense and MoE models across a wide parameter range.Multilingual AI, coding, open-model development, Asian-market enterprise AI
    NemotronNVIDIAEfficient open intelligence models optimized for reasoning, agents, and throughput on NVIDIA infrastructure — Nano, Super, and Ultra variants.Enterprise agents, high-throughput inference, NVIDIA-based AI infrastructure

    The important point: there is no single “best” model for every use case. The right model depends on the workload.

    For deep reasoning or complex coding, frontier models from OpenAI, Anthropic, Google, xAI, Mistral, DeepSeek, and Qwen all compete. For enterprise RAG and private deployment, Cohere, Mistral, and Llama-based open-weight models are attractive. For multimodal work, Gemini, GPT, Claude, Grok, and Cohere’s vision models are relevant. And for cost-sensitive, high-volume workloads, the smaller, faster variants matter most: GPT-5.6 Luna, Gemini Flash/Flash-Lite, Claude Haiku, Mistral Small, DeepSeek Flash, and compact open models.

    The practical takeaway:

    Model selection is no longer about choosing the biggest model. It is about choosing the right model for the task, cost, latency, privacy, reasoning depth, context length, and deployment environment.

    All of these models share the same transformer architecture. What differentiates them is training data, scale, fine-tuning approach, and safety alignment choices.

    Model Adaptation: Prompting, RAG, and Fine-Tuning

    A foundation model is powerful because it is general-purpose. But most real-world use cases are not general. They are specific to a task, domain, business process, tone, data source, or user workflow.

    For example, an enterprise AI assistant may need to answer questions from internal policies. A sales intelligence assistant may need to explain KPI movement using trusted business data. A legal assistant may need to draft clauses in a specific structure. A customer support bot may need to follow brand tone and escalation rules.

    This is where model adaptation becomes important. Model adaptation is the process of shaping a foundation model so that it performs better for a specific purpose. The three most common approaches are:

    Adaptation StrategyWhat it doesBest used when
    Prompt EngineeringGuides the model using instructions, examples, roles, and output formats.You need quick improvement without changing the model.
    Retrieval-Augmented Generation (RAG)Retrieves relevant external knowledge and adds it to the prompt before generation.The model needs private, current, or source-grounded information.
    Fine-TuningTrains the model further on curated examples to adjust its behavior.You need consistent domain-specific style, format, or task performance.

    Prompt Engineering

    Prompt engineering is the fastest way to adapt a model. It does not require training data, infrastructure, or model weight updates. Instead, it improves output by giving the model clearer instructions and better context. A good prompt defines the role, task, constraints, input context, and expected output format. For example:

    You are a senior business analyst. Summarize the following sales performance data into three executive insights, two risks, and three recommended actions.

    Prompting is useful for summarization, drafting, classification, ideation, analysis, and structured responses. It should usually be the first approach because it gives the fastest feedback loop. However, prompting has limits. It cannot permanently teach the model new knowledge. It is bounded by the context window and can be sensitive to wording changes.

    Retrieval-Augmented Generation

    Retrieval-Augmented Generation, or RAG, connects the model to external knowledge at the time of generation.

    Instead of relying only on what the model learned during training, a RAG system first retrieves relevant information from documents, databases, knowledge bases, or enterprise systems. That information is then added to the prompt so the model can generate a grounded answer.

    A simple RAG flow looks like this:

    User question → Retrieve relevant knowledge → Add context to prompt → Generate grounded answer

    RAG is especially useful for enterprise use cases because business knowledge changes frequently. Policies, pricing rules, sales reports, product documentation, and market updates should not be baked permanently into a model. They should be retrieved when needed.

    The biggest benefit of RAG is grounding. It helps reduce hallucinations by giving the model trusted source material. The biggest limitation is retrieval quality. If the wrong documents are retrieved, the answer may still be weak or misleading.

    Fine-Tuning

    Fine-tuning adapts the model by continuing training on curated examples. Unlike prompting and RAG, fine-tuning updates the model’s behavior.

    Fine-tuning is useful when the model needs to consistently follow a specific tone, format, vocabulary, or task pattern. For example, it can help a model write in a legal style, generate SQL from business questions, classify support tickets, or summarize performance in a standard executive format.

    Full fine-tuning can be expensive because it updates many model parameters. This is why techniques such as LoRA and QLoRA are important.

    LoRA freezes the base model and trains small adapter layers instead of updating the full model. QLoRA goes further by using quantized models to reduce memory requirements. These methods make fine-tuning more practical and cost-efficient.

    How to Choose the Right Approach

    A practical decision rule is:

    1. Start with prompting when the task can be solved with better instructions or examples.
    2. Add RAG when the model needs private, current, or source-grounded knowledge.
    3. Use fine-tuning when you need persistent behavior change and have enough high-quality training examples.

    In production, these methods are often combined. A strong enterprise AI system may use a well-designed system prompt, retrieve trusted business context through RAG, and use a fine-tuned model or adapter for domain-specific response quality. The key takeaway is simple:

    The value of Generative AI does not come only from the base model. It comes from how well the model is adapted to the task, grounded in the right context, and integrated into the workflow.

    Agentic AI: From Answering to Acting

    The next major shift in Generative AI is the move from models that only answer questions to systems that can take action.A chatbot responds to a prompt. An agent works toward a goal. Agentic AI systems can understand a task, reason through the next steps, use tools, observe results, and continue until the work is complete.

    This is often described through the ReAct pattern: Reason → Act → Observe → Reason again

    For example, if a user asks: Why did revenue decline in the Northeast region last week?

    A basic chatbot may provide a general explanation. An agentic business intelligence system can query sales data, check pricing and promotion changes, review inventory availability, identify drivers, and generate a structured recommendation.

    An AI agent typically has four components:

    ComponentRole
    PerceptionReceives user input, documents, data, or tool results.
    MemoryMaintains context, history, and relevant knowledge.
    ReasoningUses the model to plan and decide next steps.
    ActionCalls tools, APIs, databases, code, or workflows.

    Agents become powerful when connected to tools such as web search, SQL databases, Python, spreadsheets, enterprise systems, and knowledge bases. This allows them to move beyond text generation into real task execution.

    Multi-agent systems extend this idea further by using specialized agents — for example, a planner agent, research agent, data agent, and critic agent — working together on complex tasks.

    However, agentic systems also need strong governance. Once AI can take action, organizations need permissions, guardrails, audit logs, human approval for high-risk steps, and clear stopping conditions.

    The key takeaway is:

    Agentic AI is the shift from “AI that responds” to “AI that helps complete the work.”

    For businesses, this is where Generative AI moves from conversation to decision support and workflow execution.

    Where Generative AI is Used Today

    Generative AI is no longer limited to writing emails or answering generic questions. It’s now applied across business functions where teams need to understand information faster, generate insights, automate work, and move from analysis to action.

    In CPG, this is especially relevant because decisions depend on large volumes of data across sales, customers, categories, brands, promotions, pricing, supply chain, media, consumer behavior, and retail execution. The real opportunity isn’t content generation — it’s converting fragmented information into faster decisions.

    • Business Intelligence & Decision Intelligence — Traditional BI delivers dashboards and reports. Generative AI adds a conversational and narrative layer on top. A business user can ask: “Why did revenue decline in this market last week?” The system summarizes KPI movement, identifies drivers, explains variance, highlights risks, and recommends follow-up questions — shifting BI from static reporting to dialogue with data. For CPG teams, that means faster understanding of sales performance, share movement, category growth, pricing impact, and promotion effectiveness.
    • Sales & Commercial Performance — Instead of manually reviewing multiple reports, a sales leader can ask: “Which customers are driving the decline in snacks this month, and why?” The AI analyzes customer-level trends, compares against plan, summarizes drivers, and suggests actions — promotion review, distribution improvement, assortment correction, pricing intervention. Sales teams move from finding data to understanding what needs attention.
    • Revenue Growth Management — RGM teams constantly evaluate pricing, promotions, mix, pack architecture, elasticity, and margin impact. Generative AI can summarize price-increase impact, promotion ROI, margin leakage, price-pack architecture opportunities, customer-level profitability, and trade spend effectiveness. Ask: “Which promotions delivered volume growth but diluted margin?” — and complex pricing data becomes a clear business narrative with recommended next steps.
    • Retail Execution & Perfect Store — In CPG, store-level execution matters: availability, visibility, assortment, shelf placement, planogram compliance, display execution. A store visit assistant can answer: “What should I focus on in this store today?” — combining POS trends, inventory signals, planogram data, household behavior, and execution gaps into the most important actions for that visit. This is AI at the point of action, not just in corporate reporting.
    • Category Management & Shopper Insights — Category managers can ask: “What is driving share loss in this category, and which shopper segments are most impacted?” The AI synthesizes category performance, consumer behavior, customer trends, and external signals into structured insight — accelerating the path from data exploration to category strategy.
    • Marketing & Brand Performance — Campaign planning, content generation, brand performance analysis, media summaries, and consumer insight synthesis. “What themes are emerging from consumer feedback on this brand?” or “Summarize this campaign’s performance and suggest what to optimize.” For CPG brands, this speeds creative development, campaign learning, and brand narrative generation.
    • Supply Chain & Demand Planning — A planner can ask: “Which SKUs are at risk of stockout next week, and what’s driving it?” The AI combines demand, inventory, production, logistics, and service-level data into a concise summary with mitigation actions — moving supply chain teams from exception tracking to proactive decision support.
    • Customer & Account Management — Account teams juggle customer data, syndicated data, internal sales, promotion calendars, category insights, and joint business plans. “Prepare a customer performance summary for the upcoming business review.” The AI generates a structured view of growth, risks, opportunities, promotion performance, and recommended talking points — cutting preparation time and improving conversation quality.
    • Knowledge Management & Enterprise Search — Large organizations hold thousands of documents, reports, policies, decks, and meeting notes. Generative AI with RAG turns this into a searchable, conversational experience with grounded, source-cited answers — valuable for onboarding, policy lookup, project continuity, and reusing prior work.

    The Bigger Shift – Across all these use cases, the pattern is consistent. Generative AI helps teams move from:

    For CPG companies, the value is not just efficiency. The bigger value is faster decision-making across commercial, consumer, customer, supply chain, and marketing workflows. Generative AI becomes most powerful when it is connected to trusted data, business context, and the real decisions teams need to make every day.

    Limitations and Challenges

    Generative AI is powerful, but it is not magic. It can generate fluent, useful, and context-aware responses, but it can also produce incorrect, biased, incomplete, or risky outputs if not designed and governed properly. Understanding these limitations is essential for responsible use, especially in enterprise and decision-making environments.

    • Hallucinations – Generative AI models can confidently produce information that sounds correct but is factually wrong or unsupported. This is why high-impact use cases need grounding through trusted data, source citations, validation, and human review.
    • Knowledge cutoff – Base models only know what they learned during training. They cannot access recent events, live business data, or internal enterprise knowledge unless connected to tools, RAG pipelines, databases, or web search.
    • Context window limits – Models can only process a finite amount of information at one time. Larger context windows help, but they do not remove the need for good retrieval, chunking, prioritization, and prompt design.
    • Bias and fairness – Models learn from human-generated data, and that data may include social, cultural, historical, or organizational biases. Without evaluation and guardrails, AI systems can reproduce stereotypes or generate unfair recommendations.
    • Cost and compute -Large models can be expensive to run at scale. Input tokens, output tokens, embeddings, retrieval, reranking, tool calls, and latency all contribute to cost, which makes model routing, caching, quantization, and smaller specialized models important.
    • Privacy and data security – Sending sensitive business, customer, employee, or financial data to third-party APIs can create privacy and compliance risks. Regulated industries may need private deployment, data masking, access controls, audit logs, or self-hosted models.
    • Prompt sensitivity – Small changes in wording can change the model’s output. This happens because the prompt shapes the context, which influences attention patterns and the next-token probability distribution.
    • Retrieval quality – RAG improves grounding, but it is only as good as the documents retrieved. If the retrieval layer brings back incomplete, outdated, or irrelevant information, the final answer may still be misleading.
    • Evaluation difficulty – Traditional software can often be tested with fixed expected outputs. Generative AI produces open-ended responses, so quality must be measured through relevance, faithfulness, consistency, safety, usefulness, and business impact.
    • Governance and accountability – As AI systems move from answering questions to supporting decisions and actions, governance becomes critical. Organizations need clear ownership, monitoring, human escalation, usage policies, and controls around what AI can and cannot do.

    The practical lesson is simple: Generative AI should not be treated as an oracle. It should be treated as a powerful probabilistic system that needs grounding, validation, monitoring, and responsible human oversight.

    Used well, Generative AI can accelerate insight and decision-making. Used carelessly, it can scale errors, bias, and misinformation just as quickly.

    Where Generative AI is Heading

    Generative AI is moving from simple content generation to intelligent systems that can reason, act, personalize, and support complex decision-making. The next phase will be defined by six major shifts.

    • Agentic systems at scale – Enterprise software will increasingly include AI agents that can plan, use tools, coordinate with other agents, and complete multi-step workflows. The shift is from AI that only responds to AI that can help execute work.
    • Multimodal by default – Future AI systems will not treat text, images, audio, video, charts, and documents as separate experiences. They will process multiple formats together as part of one unified intelligence layer.
    • Smaller, specialized models – The future will not be only about bigger models. Smaller, fine-tuned, and domain-specific models will become more important because they can be faster, cheaper, easier to govern, and highly effective for focused tasks.
    • AI in scientific research -Generative AI will continue accelerating discovery in medicine, materials, climate science, and engineering. Approaches such as Physics-Informed Neural Networks, AlphaFold-style systems, and scientific machine learning show how AI can move beyond content generation into knowledge creation.
    • Personalization and memory – AI systems will become more context-aware over time. They will remember preferences, adapt to individual workflows, and maintain continuity across conversations, projects, and decisions.
    • Regulation, safety, and governance – As AI becomes embedded in products and business processes, safety and governance will become as important as model capability. Bias, auditability, explainability, privacy, and human oversight will be critical for responsible adoption.

    The next generation of Generative AI will not just answer questions. It will collaborate, create, research, recommend, and act alongside us. The key takeaway –

    The future of Generative AI is not only smarter models. It is better systems — grounded in context, connected to tools, governed responsibly, and designed around real human and business decisions.

    Conclusion: Generative AI as the New Intelligent Systems Layer

    Generative AI is not just a better way to write text, summarize documents, or automate repetitive tasks. It represents a deeper shift in how humans interact with knowledge, systems, and decisions. At its foundation, Generative AI begins with a simple probabilistic idea: models learn patterns from massive datasets and generate outputs by estimating what is most likely and useful in a given context. But when this capability is scaled through foundation models, powered by transformers, adapted through prompting, RAG, and fine-tuning, and extended through agents and tools, it becomes much more than text generation.

    It becomes a new intelligent systems layer. For individuals, this means faster learning, better writing, deeper analysis, and more creative problem-solving. For enterprises, it means a new way to unlock fragmented knowledge, accelerate decisions, automate knowledge work, and move from static reporting to conversational intelligence.

    The most important shift is not from human work to machine work. It is from manual interaction with information to intelligent collaboration with systems that can understand context, generate options, explain drivers, and recommend actions. But this power also brings responsibility. Generative AI systems must be grounded in trusted data, designed with guardrails, monitored for quality, and governed with clear accountability. Fluency should not be mistaken for truth. Automation should not replace judgment. The best outcomes will come from human-AI collaboration, not blind delegation.

    The future of Generative AI will be shaped by those who understand both sides of the equation: the technical foundations that make these systems possible and the human, business, and ethical contexts in which they are used. In the end, Generative AI is not only about creating content. It is about creating better ways to think, decide, build, and act. That is why understanding its foundations today is one of the most important investments for the future of work.

  • Understanding Language Models: The Foundation Behind AI Conversations

    Understanding Language Models: The Foundation Behind AI Conversations

    Every AI system you interact with today — ChatGPT, Claude, Gemini, Copilots, AI-powered search — runs on one idea: predicting the next word. That single mechanism, repeated billions of times across trillions of words, produces systems capable of reasoning, writing, coding, and conversing at a level that would have seemed impossible five years ago.

    This post explains how language models actually work — from the mathematical foundation to the architecture to the training process — and why it matters for business leaders and practitioners who want to move beyond the hype and understand what they are actually deploying.

    What is a Language Model?

    A Language Model is a probabilistic system that learns patterns in language and assigns likelihoods to sequences of words (or tokens).

    At its core, it answers a simple but powerful question – “How likely is this sequence of text?”

    Language models achieve this by learning statistical regularities from massive text corpora—capturing grammar, structure, context, and meaning in human language.

    Mathematical Foundation

    A language model is not a database of knowledge—it is a system for modeling language as probability. Formally, a language model defines a probability distribution over a sequence of words:

    P(w1,w2,...,wn)P(w_1, w_2, …, w_n)

    From Probability to Prediction

    This equation may look mathematical, but conceptually it means something simple: the model builds a sentence one word at a time, always using prior context. A language model decomposes the probability of a sequence using the chain rule, expressing it as a product of conditional probabilities:

    P(w1,…,wn)=∏i=1nP(wi∣w1,…,wi−1)P(w_1, \dots, w_n) = \prod_{i=1}^{n} P(w_i \mid w_1, \dots, w_{i-1})

    In simple terms, the model predicts each token based on all the tokens that came before it. This step-by-step prediction process is the core mechanism behind autoregressive text generation.

    This means – Given previous words, predict the next word Repeat this process to generate full sentences, This means that every possible sentence can be assigned a probability. More natural and meaningful sentences tend to have higher probabilities, while incorrect or incoherent sequences have lower probabilities. This simple yet powerful idea underpins everything from basic autocomplete features to modern AI systems.

    P(w1,w2,...,wn)P(w_1, w_2, …, w_n)

    For Example Consider the sentence: “The sun rises in the”

    A language model might assign probabilities like:

    • east → 0.85
    • west → 0.10
    • sky → 0.04
    • banana → ~0.00

    The model selects or samples from these probabilities to generate text.

    Tokens: The Building Blocks of Language

    Language models do not process raw text directly—they operate on tokens, which are smaller units of text. These tokens are typically subword units, rather than full words, allowing models to handle language more efficiently and flexibly. A token can represent:

    • A full word (e.g., “sales”)
    • A subword (e.g., “trans” + “form”)
    • Or even a character in some cases

    Examples of Tokenization

    • “transforming” → “transform” + “ing”
    • “unbelievable” → “un” + “believ” + “able”
    • “globalization” → “global” + “ization”
    • “AI-driven” → “AI” + “-” + “driven”

    Why Sub-word Tokenization Matters

    Modern language models use techniques such as Byte Pair Encoding (BPE) or WordPiece to break text into subword tokens. This design provides several key advantages:

    • Efficient vocabulary management – Instead of storing millions of full words, models operate with a manageable vocabulary (typically ~30K–100K tokens).
    • Handling unseen or rare words – New or uncommon words can be broken into known sub-words, allowing the model to still interpret them effectively.
    • Better generalization across domains – Whether it’s business terms, product names, or technical jargon, sub-word tokenization enables flexibility.
    • Language-agnostic capability – The same approach works across multiple languages, making models scalable globally.
    • Efficient computation – Smaller, reusable token units make training and inference more efficient.

    Language models do not “read words” the way humans do; instead, they process patterns of tokens. As a result, they can understand and generate new words they have never explicitly seen before, adapt seamlessly across different industries such as retail, finance, and healthcare, and operate across multiple languages using the same underlying architecture.

    Embeddings: How Does AI Translate Words into Numbers?

    Before any processing begins, tokens are transformed into numerical representations known as embeddings.

    These embeddings capture the semantic meaning of language by representing words and subwords as vectors in a high-dimensional space. As a result, tokens with similar meanings are positioned closer together, enabling the model to understand relationships, context, and nuances.

    This transformation is what makes language computable, allowing models to move from raw text to meaningful interpretation and prediction.

    What Does a Language Model Actually Learn?

    What emerges is not memorization, but a compressed representation of how language—and to some extent, the world—behaves.

    At its core, a language model does not memorize sentences—it learns patterns and structures of language from massive text data. Specifically, it learns:

    • Statistical relationships between words → which words tend to appear together
    • Grammar and syntax → how sentences are structured correctly
    • Contextual meaning → how meaning changes based on surrounding words
    • Long-range dependencies → how earlier parts of a sentence influence later parts
    • Usage patterns and style → tone, phrasing, and domain-specific language

    In essence, a language model builds a probabilistic map of language, allowing it to generate text that is coherent, context-aware, and human-like.

    In simple words, a language model does not “store knowledge” like a database—it learns how language behaves. This is why it can:

    • Generate entirely new sentences
    • Occasionally produce fluent but incorrect responses
    • Adapt to different contexts and tones

    The Transformer + Attention: Engine Behind Modern Language Models

    The Transformer architecture is the core engine behind modern language models. It enables models to process entire sequences of text simultaneously and learn relationships between words efficiently.

    The Transformer architecture, introduced in the landmark 2017 paper “Attention is All You Need”, solved a fundamental problem with earlier models: they processed text sequentially, meaning they struggled to connect words that were far apart in a sentence. Transformers eliminated this bottleneck by processing all tokens simultaneously.

    Here’s what happens inside a single Transformer block:

    Step 1 — Multi-Head Self-Attention. Every token in the sequence looks at every other token and asks: “How relevant are you to me?” This is computed using three learned vectors per token — Query (what am I looking for?), Key (what do I offer?), and Value (what information do I carry?). The dot product of Query and Key produces an attention score, which is normalized via softmax so all scores sum to 1. The output is a weighted combination of Value vectors — meaning each token’s representation is now informed by the entire sequence.

    Running this process across multiple “heads” in parallel lets the model simultaneously learn different types of relationships — grammatical agreement, coreference, positional proximity, and semantic similarity — all within the same layer.

    Step 2 — Feed-Forward Network. After attention, each token’s updated representation passes through a small two-layer neural network independently. This is where the model applies non-linear transformations that allow it to encode more complex patterns.

    Step 3 — Residual Connections & Layer Normalization. Both steps above are wrapped with a residual connection (the input is added back to the output) and layer normalization. This stabilizes training and allows gradients to flow cleanly through dozens of stacked layers.

    A modern LLM stacks anywhere from 12 to 96 of these blocks. Each layer refines the model’s understanding — early layers tend to capture syntax and local patterns, while deeper layers encode abstract reasoning and semantics.

    At a high level, the process works as follows:

    • Input tokens are converted into embeddings, which represent words as numerical vectors
    • These embeddings pass through multiple Transformer layers, each refining the model’s understanding of context
    • Within each layer, the model uses self-attention to determine how much focus to give to different tokens in the sequence
    • The output is a set of contextualized representations, which are then used to predict the next token

    Example – “The Sun rises in the …” The model focuses more on:

    • “Sun” → high importance
    • “rises” → high importance
    • Leading to prediction: “east”

    Unlike earlier models that processed text sequentially, Transformers analyze the entire context at once—making them significantly more powerful for understanding language.

    Attention: How Models Understand Context

    The key innovation in the Transformer is self-attention — and it is worth understanding clearly because it is the mechanism that gives language models their power.

    Each token generates three vectors: a Query (what am I looking for?), a Key (what do I offer?), and a Value (what information do I carry?). The dot product of a token’s Query with every other token’s Key produces an attention score — a measure of how relevant each other token is. These scores are normalised and used to produce a weighted combination of Value vectors, giving each token a new, context-aware representation.

    Example: In a sales report containing the sentence “Our spring promotion drove a spike in volume but compressed margin across the portfolio”, the word margin could refer to profit margin, page margin, or margin of error depending on context. Self-attention resolves this instantly: the tokens promotion, volume, compressed, and portfolio all score highly against margin‘s Query vector, anchoring its meaning unambiguously to commercial profitability — without any hand-coded rules or lookup tables. The same mechanism works across every domain: a model reading a trade spend summary, a sell-in forecast, or a retailer negotiation brief will correctly resolve ambiguous terms based purely on the surrounding context it has learned to attend to.

    Multi-head attention runs this entire process in parallel across multiple heads, each learning a different type of relationship. One head might track which pronoun refers to which noun. Another tracks subject-verb agreement. Another tracks semantic similarity across the sentence. Their outputs are concatenated and projected, giving the model a richer understanding than any single attention pass could provide.

    Pre-training and Adaptation

    Building a capable language model happens in two distinct phases — and the difference between them matters enormously for how the model behaves in practice.

    Phase 1: Pre-Training

    In pre-training, the model is trained on a massive corpus of text — web pages, books, code, scientific papers, and more — spanning trillions of tokens. The training objective is deceptively simple: predict the next token given all previous tokens. This is called autoregressive or causal language modelling.

    Through billions of iterations of this prediction task, the model is forced to internalize grammar, factual knowledge, reasoning patterns, coding conventions, and domain-specific language — not because it was explicitly taught these things, but because they are all implicit in the statistical structure of human-generated text. The result is a powerful but unaligned base model: it can complete text fluently, but it has no concept of helpfulness, safety, or following instructions.

    Phase 2: Adaptation & Alignment

    The base model is then specialized through a series of fine-tuning steps:

    Supervised Fine-Tuning (SFT) — Human annotators write high-quality example responses to a diverse set of prompts. The model is fine-tuned on these demonstrations, teaching it the format and style of a helpful assistant.

    Reinforcement Learning from Human Feedback (RLHF) — Human raters compare pairs of model outputs and indicate which is better. A separate “reward model” is trained on these preferences. The language model is then optimized using reinforcement learning (specifically Proximal Policy Optimization, or PPO) to generate responses that score highly according to the reward model. This is how models learn to be helpful, honest, and appropriately cautious.

    Constitutional AI (CAI) — Developed by Anthropic, this technique reduces reliance on large volumes of human labelling. Instead, the model is given a written set of principles (a “constitution”) and uses AI-generated feedback — rather than human feedback alone — to evaluate and revise its own outputs. This makes alignment more scalable, transparent, and consistent.

    These steps are what transform a raw text predictor into the AI assistants that feel responsive, safe, and genuinely useful in practice

    Context Window: The Model’s Working Memory

    The context window defines how much text a language model can consider at once when generating output. It is, in effect, the model’s working memory.

    The model receives a sequence of tokens — your prompt plus any prior conversation — and can only draw on information within this fixed window. Everything outside it is invisible.

    Why context window size matters for business:

    • Long document processing — Larger windows allow the model to read entire contracts, reports, or transcripts in a single pass without losing earlier information.
    • Coherent conversations — The model can maintain context across a long back-and-forth without losing the thread of what was established earlier.
    • Cross-section reasoning — With sufficient context, the model can connect information from different parts of a document — essential for tasks like due diligence, summarisation, and compliance review.

    Context windows have grown dramatically: from 4,000 tokens in early GPT-3 to 128,000 in GPT-4, 200,000 in Claude 3, and over one million in Gemini 1.5. As windows grow, language models become capable of handling more complex, real-world tasks with less pre-processing overhead.

    One important caveat: attention is computationally expensive — it scales quadratically with sequence length. Longer contexts cost more to run. Techniques like Retrieval-Augmented Generation (RAG), which inject only the most relevant information into a shorter context, are widely used in production deployments to manage this tradeoff.

    How Language Models Generate Text

    Once a prompt is given, text generation follows a repeated loop:

    1. The prompt is tokenised and converted to embeddings
    2. The full sequence passes through all Transformer layers
    3. The final layer produces a probability distribution over the vocabulary
    4. A token is sampled from this distribution (controlled by temperature, top-p, or top-k settings) . The new token is appended to the context
    5. The loop repeats from step 2 until the model generates an end-of-sequence token.

    The important thing to remember is that the model is not writing with a full outline in mind. It is continually extending a sequence through context-conditioned prediction. Coherence emerges from the quality of the learned probability model and the richness of the context, not from a symbolic plan stored in advance.

    Three sampling parameters give you control over the output:

    • Temperature — scales the probability distribution. Low temperature makes output deterministic and focused. High temperature introduces more variety and creativity.
    • Top-p (nucleus sampling) — restricts sampling to the smallest set of tokens whose combined probability reaches a threshold p. Ignores the long, implausible tail.
    • Top-k — restricts sampling to the k most likely tokens at each step. Simple and effective.

    Understanding these parameters matters in production: the right settings vary significantly depending on whether you want precise, factual outputs (low temperature) or creative, generative ones (higher temperature).

    Why Do Language Models Make Mistakes?

    Understanding limitations is as important as understanding capabilities — especially for any organisation deploying these systems in consequential workflows.

    Hallucination – Language models generate text by predicting what comes next based on learned patterns, n ot by retrieving verified facts. This means they can produce responses that are fluent, confident, and completely incorrect. A model may fabricate a statistic, misattribute a quote, or describe a process that does not exist — with the same tone it uses when it is right. Human review is essential for any output where factual accuracy is critical.

    Knowledge cutoff – Pre-training has a fixed endpoint. Anything that occurred after the training data was collected — recent earnings results, regulatory changes, new product launches — is invisible to the model unless explicitly provided in the prompt or retrieved via external tools. This is why RAG has become standard practice in enterprise deployments: it extends the model’s effective knowledge by injecting current information at inference time.

    Reasoning limitations – Language models can appear to reason — and often do so impressively — but they are fundamentally pattern-matchers, not formal reasoning engines. They can struggle with multi-step arithmetic, strict logical deduction, and tasks requiring precise state tracking across many steps. Techniques like chain-of-thought prompting and tool use help significantly, but do not fully eliminate these gaps.

    Context boundary effects – Information near the beginning of a very long context can receive less effective attention than recent inputs, leading to inconsistencies in long-document tasks. Prompt design and document chunking strategies can mitigate this.

    For organisations, the practical conclusion is this: language models are most powerful when paired with human oversight, structured validation, and well-designed workflows — not when treated as autonomous sources of truth.

    Why Language Models Matter for Business

    Language models are often viewed as tools for generating text—writing emails, summarizing documents, or answering questions. But in a business context, their role is far more significant.

    Language models are not just AI tools—they are decision enablers.

    At their core, they transform how organisations interact with data, insights, and knowledge. Instead of navigating dashboards, reports, and fragmented systems, business users can engage with information conversationally — asking questions, exploring scenarios, and receiving contextual answers in real time.

    Where Language Models Create Business Value

    1. AI-Driven Insights and Narratives – Language models transform complex data into clear, human-readable insights. Instead of static dashboards, leaders receive automated performance summaries, root-cause explanations, and forward-looking narratives. This shifts analytics from data consumption to insight-driven action
    2. Conversational Analytics – Business users no longer need to rely on predefined reports or technical teams. They can simply ask questions such as “Why did sales decline this quarter?” or “Which channels are driving growth vs last year?” Language models interpret intent, query underlying data, and generate contextual responses—democratizing analytics across the organization.
    3. Enterprise Copilots – Language models act as intelligent assistants embedded within workflows. They support sales teams with account insights, marketing teams with campaign recommendations, and supply chain teams with demand signals. Instead of searching for information, teams receive proactive, contextual guidance.
    4. Decision Intelligence Platforms – The most advanced application integrates language models into decision systems that combine internal and external data, business logic — KPIs, rules, models — and AI reasoning. The outcome is not just answers but actionable recommendations that guide decisions at every level of the organization.

    The Real Value

    Organizations that leverage language models effectively can scale expertise across the enterprise, reduce time to insight, improve decision quality, and align teams around a single version of truth.

    The true value of language models is not in generating text—it is in enabling faster, better, and more consistent decisions.

    Language models are redefining how businesses operate — not by replacing human judgment, but by augmenting it. Organisations that deploy them effectively can scale expertise across the enterprise, compress time-to-insight, improve decision quality, and align teams around a shared, real-time understanding of performance. In an era defined by the speed of information, that is a durable competitive advantage.