Innovative AI Solutions | AI Development, Web & Mobile Apps – Delhi, India

From Chatbots to Agentic Workflows: How AI is Reshaping Web Development

From Chatbots to Agentic Workflows: How AI is Reshaping Web Development - Innovative AI Solutions Blog

 What Is an Agentic Workflow?

An agentic workflow is an AI system that decomposes a user's high-level goal into a sequence of discrete actions, executes those actions by calling tools or APIs, and adapts its plan based on results — all with minimal human intervention.

The Core Loop of Agentic AI

 
 
Stage What Happens Example
User goal "Book me a flight to Bengaluru next Thursday" User types natural language request
Planning Agent breaks down the task "First, check availability. Second, verify budget. Third, book if conditions met."
Action Agent calls tools/APIs search_flights(date, destination)check_budget(price)
Observation Agent receives results "Flights available at 8 AM, 2 PM. Price ₹5,200 within budget."
Reasoning Agent decides next step "Book the 8 AM flight."
Action Agent calls booking API book_flight(flight_id)
Result User notified "Your flight is confirmed. Ticket sent to email."

Unlike a chatbot, an agent doesn't just answer questions — it acts on the user's behalf across multiple systems.

Key Architectural Shifts

 
 
Traditional Web App Agentic Web App
User navigates pre‑defined UI AI generates UI dynamically based on task
Backend API endpoints for every possible action Agent calls a set of tools (APIs) flexibly
Error handling is deterministic Agent self‑corrects, tries alternative paths
State stored in database, accessed by endpoints Agent maintains session state across tool calls
Frontend‑backend boundaries clear Agent orchestrates across multiple services

Step 3: Agentic Architecture – The Mental Model

Think of an agentic workflow as a persistent, stateful session where the agent has access to:

 
 
Component Responsibility Example
Orchestrator (Planner) Breaks user goal into steps LangGraph, AutoGen, or custom orchestration
Executor (Agent) Carries out each step by calling tools Vercel AI SDK, OpenAI Assistants, Claude 3.5 Agent Skills
Tool Registry List of available APIs with schemas Stripe API, Email API, Database queries
Memory Store Persistent session state Redis, PostgreSQL, In‑memory (short sessions)

"Agents aren't just a new frontend pattern. They're a new backend pattern — one where the AI orchestrates your APIs, not your frontend." – Software Engineering Daily

Step 4: Tool Calling – The Bridge Between AI and Your Backend

The most critical capability enabling agentic workflows is tool calling (also called function calling). The LLM outputs a structured JSON object that represents an API call your backend should execute.

Tool Call Example – Anthropic Claude 3.5

json
{
  "name": "book_flight",
  "input": {
    "origin": "DEL",
    "destination": "BLR",
    "date": "2026-06-06",
    "passengers": 1
  }
}

Your backend receives this, executes the actual API call, and returns the result to the LLM for the next reasoning step.

Tool Calling Implementation – Vercel AI SDK

typescript
// Next.js API route – tool definition
export async function POST(req: Request) {
  const { messages } = await req.json();

  const result = await streamText({
    model: anthropic('claude-3-5-sonnet-20241022'),
    tools: {
      getWeather: {
        description: 'Get the weather in a location',
        parameters: z.object({
          location: z.string().describe('The city and state, e.g., San Francisco, CA'),
          unit: z.enum(['celsius', 'fahrenheit']).default('celsius'),
        }),
        execute: async ({ location, unit }) => {
          const weather = await fetchWeather(location, unit);
          return weather;
        },
      },
    },
  });

  return result.toDataStreamResponse();
}

"In 2026, every backend API endpoint should be designed as a tool an agent can call — not just a UI‑driven endpoint."

Step 5: Generative UI – The Final Frontier

Perhaps the most mind‑bending shift is Generative UI (GenUI) – the AI decides what interface to render dynamically, based on the current state of the agent workflow .

Traditional UI vs. Generative UI

 
 
Aspect Traditional UI Generative UI
Who designs the interface? Developer (pre‑coded) AI (runtime)
Interface components Fixed set Generated on‑the‑fly
Adaptability Low (requires code change) High (adapts to user intent)
Codebase Static components AI‑generated + cached
Example Pre‑built flight booking form AI generates form after user asks "Book a flight"

How Generative UI works: The LLM outputs a structured JSON specifying which component to render (button, chart, form, data table). The frontend receives this JSON and dynamically instantiates the component.

Why GenUI for Agentic Workflows?

 
 
Problem GenUI Solution
Agent returns complex data (e.g., multi‑step plan) Renders as structured checklist, not plain text
Agent needs user input mid‑workflow (e.g., "Choose a flight") Generates a form with validation
Agent wants to present multiple options for comparison Renders a comparison table
Agent needs to confirm a destructive action Generates confirmation dialog

Early examples: Vercel AI SDK's generateUI and the experimental GenUI patterns demonstrated in 2026 allow developers to register available UI components, and the AI decides which to render based on the current agent state .

Step 6: Building a Complete Agentic Web Application – A Practical Workflow

Let me walk through a complete example: a customer support agent that can look up orders, process returns, and issue refunds.

Phase 1: Tool Definitions (Backend)

typescript
// lib/tools.ts
export const tools = {
  lookupOrder: {
    description: 'Get order details by order ID',
    parameters: z.object({ orderId: z.string() }),
    execute: async ({ orderId }) => db.orders.find(orderId)
  },
  processReturn: {
    description: 'Initiate a return for an order item',
    parameters: z.object({
      orderId: z.string(),
      itemId: z.string(),
      reason: z.string()
    }),
    execute: async ({ orderId, itemId, reason }) => {
      return db.returns.create({ orderId, itemId, reason, status: 'pending' });
    }
  },
  issueRefund: {
    description: 'Issue a refund for a return (requires manager approval for > ₹5000)',
    parameters: z.object({
      returnId: z.string(),
      amount: z.number()
    }),
    execute: async ({ returnId, amount }) => {
      if (amount > 5000) return { requiresApproval: true, returnId };
      return db.refunds.create({ returnId, amount });
    }
  }
};

Phase 2: Orchestration (Backend)

typescript
// app/api/agent/route.ts
import { tools } from '@/lib/tools';
import { streamText } from 'ai';

export async function POST(req: Request) {
  const { messages, sessionId } = await req.json();

  // Load persistent memory for this session
  const memory = await getSessionMemory(sessionId);

  const result = await streamText({
    model: anthropic('claude-3-5-sonnet-20241022'),
    messages: [...memory, ...messages],
    tools,
    systemPrompt: `You are a customer support agent for an e-commerce store.
    You can look up orders, process returns, and issue refunds.
    Refunds over ₹5000 require manager approval.
    Keep your responses concise and helpful.`
  });

  // Save updated memory
  await updateSessionMemory(sessionId, result.messages);

  return result.toDataStreamResponse();
}

Phase 3: Frontend (React + AI SDK)

tsx
// components/AgentChat.tsx
import { useChat } from 'ai/react';

export function AgentChat() {
  const { messages, input, handleInputChange, handleSubmit, isLoading } = useChat({
    api: '/api/agent',
    body: { sessionId: crypto.randomUUID() }
  });

  return (
    <div>
      {messages.map(m => (
        <div key={m.id}>
          <strong>{m.role}:</strong> {m.content}
          {/* Generative UI: Render component if AI specifies */}
          {m.toolCalls?.map(tool => renderToolUI(tool))}
        </div>
      ))}
      <form onSubmit={handleSubmit}>
        <input value={input} onChange={handleInputChange} disabled={isLoading} />
      </form>
    </div>
  );
}

Step 7: State Management in Agentic Workflows

State management becomes more complex in agentic systems because the AI persists memory across turns, and the backend must maintain session context.

Memory Types

 
 
Memory Type Storage Persistence Example
Ephemeral (in‑turn) In‑memory (LLM context window) One API call Current tool call chain
Session Database (Redis, PostgreSQL) Entire user session "User already provided order ID"
Long‑term Database + vector embeddings Across sessions User preferences, past interactions

Implementation – Session Memory with Redis

typescript
// lib/memory.ts
import { Redis } from '@upstash/redis';

const redis = Redis.fromEnv();
const SESSION_TTL = 3600; // 1 hour

export async function getSessionMemory(sessionId: string) {
  const messages = await redis.lrange(`session:${sessionId}`, 0, -1);
  return messages.map(JSON.parse);
}

export async function updateSessionMemory(sessionId: string, newMessages: Message[]) {
  await redis.rpush(`session:${sessionId}`, newMessages.map(JSON.stringify));
  await redis.expire(`session:${sessionId}`, SESSION_TTL);
}

Step 8: Security and Guardrails – The Hard Part

Agentic systems introduce new security challenges: tool call injection, excessive tool calls (cost blow‑up), and unintended side effects .

Guardrails to Implement

 
 
Guardrail Implementation
Budget limits Per‑request tool call limit, cost caps
Authorization checks Tool calls verify user permission before execution
Destructive action approval Require explicit user confirmation before delete/update
Tool call validation Validate parameters against schema before execution
Audit logging Log every tool call with user ID, timestamp, outcome

Example – Confirmation for Destructive Actions

typescript
if (toolName === 'deleteAccount' && !userConfirmed) {
  return { requiresConfirmation: true, message: 'Are you sure you want to delete your account?' };
}

Step 9: Performance and Cost Optimization

Agentic workflows are more expensive than simple chatbots because each turn may involve multiple tool calls and reasoning steps.

Cost Drivers

 
 
Factor Impact
Number of tool calls per session Each tool call adds token cost
Context length (session memory) Longer memory = more input tokens
Model size Sonnet costs more than Haiku
Parallel tool calls Can reduce latency but increases cost

Optimization Techniques

 
 
Technique Benefit
Prompt caching Caches system prompt and tool definitions (up to 90% cost reduction for repeated contexts)
Small model for routing Use Haiku for simple tasks; Sonnet only for complex reasoning
Tool call batching Execute multiple independent tool calls in parallel
Context compaction Summarize old session memory instead of storing raw messages
Session timeout Expire idle sessions to limit memory growth

Step 10: The 2026 Stack for Agentic Web Apps

 
 
Layer Technology Role
Framework Next.js 15+ (App Router) Server components, API routes
AI SDK Vercel AI SDK 5.0 Unified tool calling, streaming, generative UI
Model Claude 3.5 Sonnet / GPT‑5o Best‑in‑class tool calling
Orchestration LangGraph or native Vercel AI SDK Complex multi‑step workflows
Memory Upstash Redis / PostgreSQL Session and long‑term memory
Auth Auth.js, Clerk User identity for tool authorization
Observability LangSmith / Langfuse Trace agent decisions, cost tracking

Step 11: Frequently Asked Questions

Q1: What is the difference between a chatbot and an agentic workflow?

A chatbot answers questions. An agentic workflow takes actions across your systems. The agent has tools (API calls) it can execute, memory across sessions, and the ability to reason about multi‑step plans.

Q2: Do I need LangGraph for agentic workflows?

Not necessarily. The Vercel AI SDK's native tool calling handles many single‑agent, single‑turn workflows. LangGraph becomes necessary for multi‑agent systems (where multiple specialized agents collaborate) or complex state machines with human‑in‑the‑loop.

Q3: How do I prevent an agent from making too many tool calls (cost blow‑up)?

Set per‑request tool call limits. Implement approval for costly actions (e.g., "This will take 10 API calls. Confirm?"). Monitor token usage in production and set budget alerts.

Q4: Can agents work offline or on the edge?

Yes — with smaller models. On‑device agents using models like Phi‑3 mini or Llama 3 8B can run locally, but tool calling requires network access (except for local‑only tools like filesystem access).

Q5: What is generative UI, and is it production-ready?

Generative UI is the AI's ability to render dynamic interfaces at runtime (charts, forms, data tables) rather than returning raw text. It is experimental but emerging — tools like Vercel AI SDK offer generateUI for limited component rendering.

Q6: How do I test agentic workflows?

Testing agents is harder than testing deterministic code because outputs are non‑deterministic. Approaches:

Q7: How can Innovative AI Solutions help?

We help teams design, build, and deploy agentic web applications — from tool definition and orchestration to memory management and guardrails.

 Book a free consultation →

Step 12: Final Tagline

"The future isn't just about AI giving answers. It's about AI taking action. We're moving from chatbots that talk to agentic workflows that do — reshaping how we build, secure, and scale web applications."

Short version:
From chatbots to agentic workflows – how AI is reshaping web development in 2026. Tool calling, generative UI, state management, security, and the complete agentic stack.

Hashtags:
#AgenticWorkflows #GenerativeUI #AIToolCalling #Nextjs #VercelAISDK #WebDevelopment #AIagents #InnovativeAISolutions

Contact Us

Phone: +91 7464 099 059 / +91 96899 67356
Email: info@innovativeais.com
Address: Netaji Subhash Place, Pitampura, Delhi – 110034
Website: https://innovativeais.com

 
 
 
 
 
📢 Share this article:

Ready to build AI solutions for your business?

Innovative AI Solutions — Delhi's leading AI development company. Free consultation available.

Get Free Consultation →