Skip to main content
XenonStack

Enterprise AI

XenonStack Blog LangChain Agents: Building Generative AI Applications

and | Published

LangChain Agents: Building Generative AI Applications
7:44

Key takeaway

  • How LangChain, LangGraph and LangSmith fit together for generative AI agents: create_agent, state, memory, evaluation and the governance agents need.

LangChain is an open-source framework for building applications and agents on large language models. Since version 1.0, released with LangGraph 1.0 on 22 October 2025, the standard way to build an agent is LangChain's create_agent, which runs on the LangGraph runtime, while LangSmith traces and evaluates what the agent does. Together they cover the build, run and observe stages of a generative AI agent.

This guide explains where generative agents came from, how the three LangChain products divide the work, how an agent loop runs, and what enterprises must add before an agent touches real systems.

What are generative agents?

The term comes from the Stanford and Google research paper Generative Agents: Interactive Simulacra of Human Behavior (Park et al., 2023). It described software agents that remember experiences, reflect on them and plan, so their behaviour stays believable over time. The architecture had three parts: a memory stream that records observations, a reflection step that turns memories into higher-level conclusions, and a planner that decides what to do next.

LangChain shipped an early implementation of the idea. Today the same building blocks, memory, reflection and planning, appear in most enterprise agents, whether they write code, handle service tickets or investigate fraud alerts. Our overview of how large language models power AI agents covers the wider picture.

How do LangChain, LangGraph and LangSmith fit together?

ProductRoleUse it when
LangChainBuilding blocks and the high-level create_agent API, with middleware hooks to customise each step of the agent loopYou want a working agent quickly with any model provider
LangGraphLow-level orchestration runtime: graphs of nodes and edges, durable state, interrupts for human approval, resumable executionYou need custom control flow, long-running work or multi-agent designs
LangSmithTracing, evaluation and monitoring; framework-agnostic and supports OpenTelemetryYou need to debug, test and prove agent quality in production

The 1.0 release announcement also deprecated LangGraph's create_react_agent in favour of create_agent and moved older features into a separate legacy package. Code that still uses LLMChain or initialize_agent predates this change and should be migrated.

How does a LangChain agent work?

An agent is a loop: the model decides whether to answer or call a tool, the tool runs, and the result goes back to the model until the task is done.

Flow diagram of a LangChain agent loop: request, model reasons, tool call, observe result, update state and memory, then respond, with human approval for risky actions

  1. Request: a user or system event starts the run, with a system prompt that defines the agent's job.
  2. Reason: the model reads the request, the state and the available tools, and chooses the next step.
  3. Act: the agent calls a tool, such as a database query, an API or a search over documents.
  4. Observe: the tool result is added to the conversation state.
  5. Remember: LangGraph persists state, so a long task can pause for human approval and resume later.
  6. Respond: once the model has enough, it returns a structured answer or completes the action.

What can enterprises build with LangChain agents?

  • Knowledge assistants that answer questions from policies, contracts and manuals with citations.
  • Service and IT operations agents that triage tickets, gather diagnostics and propose fixes.
  • Analyst agents that query data, build a first draft of a report and explain the drivers.
  • Software delivery agents that write tests, review changes and summarise pull requests.
  • Simulation agents in the original generative-agents sense, used to test plans, training scenarios or customer journeys.

For build-versus-buy choices, see our guide to custom AI agents.

What are the risks of LangChain agents in production?

RiskWhat goes wrongControl
Prompt injectionText in a document or web page tells the agent to ignore its instructionsTreat tool output as data, restrict tools, validate actions
Excess permissionsAn agent with broad API keys can change records it should only readLeast-privilege tools, per-action policy checks
Silent quality driftA model or prompt change degrades answers without anyone noticingEvaluation data sets and tracing in LangSmith or similar
Runaway costLoops and long contexts multiply token spendStep limits, caching, model routing, budgets
No audit trailNobody can show why the agent made a decisionDecision traces that link input, context, policy and outcome

Our guides to agentic AI security and LLM observability in production go deeper on these controls.

Where does governance sit around a LangChain agent?

A framework builds the agent; it does not decide what the agent is allowed to do in your business. That needs a layer that knows the decision context, the policy and the approvals, whichever framework the agent is written in.

Solution diagram: agent frameworks such as LangChain and LangGraph run under ElixirClaw governance with decision context from ElixirData Context OS, connected to enterprise systems

This is where XenonStack fits. ElixirClaw is our AI agents computing platform for running enterprise agents with policy, approvals and monitoring. ElixirData Context OS supplies the decision context each agent needs and records a decision trace for audit. Teams can keep the frameworks their engineers prefer while the business keeps control of what agents decide. See also composable skills for agentic AI.

How should a team start with LangChain agents?

  1. Pick one bounded task with a clear owner and a measurable outcome.
  2. Start with create_agent and two or three read-only tools; add write actions only behind approval.
  3. Turn on tracing from day one and build a small evaluation set of real cases.
  4. Move to custom LangGraph graphs only when the task needs branching, long-running state or several agents.
  5. Define the policy and audit requirements before production, not after the first incident.

For the wider landscape, read our guide to what AI agents are.

To map one decision your agents should make, and the context and policy it depends on, book a Context Workshop. See what happens in the workshop.

Frequently asked questions

What is the difference between LangChain and LangGraph?

LangChain provides building blocks and the high-level create_agent API for a fast start. LangGraph is the lower-level runtime underneath, used for custom control flow, durable state, human-in-the-loop interrupts and multi-agent designs. Since version 1.0, create_agent runs on LangGraph.

Is LangChain still used in 2026?

Yes. LangChain and LangGraph reached version 1.0 in October 2025 with a commitment to stability, and LangSmith is widely used for tracing and evaluation. Older tutorials that use LLMChain or initialize_agent are out of date, though the concepts still apply.

What are generative agents?

Generative agents are AI agents that store memories, reflect on them and plan their behaviour. The concept comes from a 2023 Stanford and Google paper that simulated a small town of agents with believable daily routines.

Do I need LangSmith to use LangChain?

No. LangSmith is optional, and it also works with agents built on other frameworks or custom code. Most production teams use some form of tracing and evaluation, because agents fail in ways that ordinary logs do not reveal.

How do you govern a LangChain agent in an enterprise?

Limit each agent to least-privilege tools, require human approval for high-risk actions, evaluate quality continuously and record a decision trace that links the input, context, policy and outcome of every action.

Follow XenonStack on LinkedIn: XenonStack on LinkedIn for new guides on agentic AI, data and platform engineering.

Table of Contents

navdeep-singh-gill

Navdeep Singh Gill

Global CEO and Founder of XenonStack

LinkedIn profile

Navdeep Singh Gill is serving as Chief Executive Officer and Product Architect at XenonStack. He holds expertise in building SaaS Platform for Decentralised Big Data management and Governance, AI Marketplace for Operationalising and Scaling. His incredible experience in AI Technologies and Big Data Engineering thrills him to write about different use cases and its approach to solutions.

Get the latest articles in your inbox

Subscribe Now

Interested in solving your challenges with the XenonStack team?
Get Started

Tell us about you and your priorities so we can prepare the right conversation. It takes about 2 minutes.

Please Select your Industry
Banking
Fintech
Payment Providers
Wealth Management
Discrete Manufacturing
Semiconductor
Machinery Manufacturing / Automation
Appliances / Electrical / Electronics
Elevator Manufacturing
Defense & Space Manufacturing
Computers & Electronics / Industrial Machinery
Motor Vehicle Manufacturing
Food and Beverages
Distillery & Wines
Beverages
Shipping
Logistics
Mobility (EV / Public Transport)
Energy & Utilities
Hospitality
Digital Gaming Platforms
SportsTech with AI
Public Safety - Explosives
Public Safety - Firefighting
Public Safety - Surveillance
Public Safety - Others
Media Platforms
City Operations
Airlines & Aviation
Defense Warfare & Drones
Robotics Engineering
Drones Manufacturing
AI Labs for Colleges
AI MSP / Quantum / AGI Institutes
Retail Apparel and Fashion

Continue