AI Labs
All examples

Operational Copilot with Streaming Tools

Streaming agent on Vercel AI SDK with tool calling for CRM lookup and ticket creation.

AgentsStreamingHuman escalation

Target outcomes

  • Target: 15 to 25% reduction in average handle time for tier-1 intents
  • Override rate < 10% before expanding write tools
  • Supervisor pickup SLA tracked on escalated sessions

Initiative playbook

Typical delivery arc for this pattern in enterprise programs.

  1. 1
    Discovery2 to 4 wks

    Map operator workflows and CRM/ticket APIs; define escalation triggers (billing, legal, explicit human request) and supervisor SLAs.

  2. 2
    Pilot6 to 8 wks

    Ship read-only tools plus escalation queue to 20 users; measure handle-time, override rate, and pickup time.

  3. 3
    Scaleongoing

    Add write tools behind approval gates, integrate ServiceNow/Teams supervisor routing, and policy-as-code on Vercel.

Business use case

Problem

Operations and support teams lose time toggling between CRM, ticketing, and chat. Leaders want assistive AI that respects existing systems of record, not a rip-and-replace chatbot on day one.

Who benefits

  • Tier-1 agents, faster account lookup and ticket drafting
  • Operations managers, auditable tool traces for quality review
  • Platform teams, a pattern that swaps mock tools for real APIs incrementally

Success metrics

  • 15 to 25% reduction in average handle time on covered intents
  • Human override rate under 10% before enabling write actions in production
  • Median supervisor pickup time under 5 minutes for escalated sessions
  • Time-to-first-value under 6 weeks in pilot

Solution

A streaming operational copilot on Vercel: the model calls deterministic tools (customer lookup, ticket create, supervisor escalation) so answers are grounded in structured data. Policy rules detect billing disputes, legal language, and explicit human requests; the UI shows a live supervisor queue alongside streamed tool traces.

Technical implementation

Stack

  • Next.js route handler (server)
  • Vercel AI SDK v6, streamText, tools, convertToModelMessages
  • OpenAI or Vercel AI Gateway for the model endpoint
  • @ai-sdk/react, useChat + DefaultChatTransport in the browser

Architecture

What happens when a tier-1 agent sends one message, policy first, then tools, then the model stream.

How it runs
Drawing the flow…

Implementation highlights

  • Tool inputSchema uses Zod so arguments match future Salesforce/ServiceNow contracts
  • escalateToSupervisor enqueues cases with priority; POST /api/demos/vercel-escalations supports UI-initiated handoff
  • escalation-policy.ts blocks enterprise billing tickets until a supervisor is involved
  • stopWhen: stepCountIs(6) prevents unbounded agent loops
  • toUIMessageStreamResponse() streams UI message parts including tool events
  • Mock CRM in lib/demos/mock-crm.ts stands in for enterprise APIs during pilot

Outcomes and learnings

The pattern that held up in reviews: make escalation boring and explicit before you give the model write access to anything customer-facing.

  • Mirror production API shapes in tool schemas early, migration is configuration, not rewrite
  • Show tool traces in the UI; operators trust copilots they can audit
  • Cap agent steps and log every tool call before expanding to write operations
  • Treat escalation as a first-class tool, not a fallback paragraph in the system prompt

Where else this applies

This pattern is not only for contact centres. Any workflow where a model proposes actions against systems of record, but humans must stay accountable, fits the same shape.

Field service dispatch

Look up work orders, suggest parts, and escalate weather or safety exceptions to a regional supervisor.

Internal IT service desk

Reset-password guidance with read-only AD lookups first; write actions only after approval.

Revenue operations

Draft quote adjustments and contract summaries from CRM, with deal-desk escalation on non-standard terms.

Banking servicing

Payment investigation copilot with hard blocks on wire transfers until a human signs off.

Using this stack elsewhere

On Vercel you get low-latency streaming, serverless scale-to-zero, and AI SDK tool contracts you can swap from mocks to Salesforce, ServiceNow, or internal APIs without rewriting the UI.

Live demo

The demo is the same code path described above, not a simplified mock UI. Add keys in .env.local when you are ready; the narrative and diagrams stand on their own without them.

Business

Pretend you are tier-1 support: look up Northwind, try a billing refund on C-1001 (watch it get blocked), or ask for a supervisor. The queue on the right is the same session as your chat.

Technical

streamText with CRM, ticket, and escalateToSupervisor tools; policy hints land in the system prompt before the model acts. Queue API is session-scoped at /api/demos/vercel-escalations.

Streaming operational copilot

Tool-backed chat with CRM lookup, tickets, and simulated supervisor handoff.

Live

Try enterprise billing disputes or request a supervisor once — the handoff panel shows briefing and pickup.