All work 03 / 08 · Shiprocket Copilot

An assistant that does the work.

A realtime voice and chat copilot embedded in the seller back-office — it retrieves knowledge, streams answers, and executes tools against live order workflows.

Role
Lead engineer — AI & product
Timeline
2023 — 2024
Stack
Next.js · NestJS · OpenAI · WebRTC · MCP · RAG
Status
Live · 10K+ queries/month

01Problem

Sellers lived in support queues for actions the system could perform in seconds — "where is order 4127", "reschedule this pickup", "why was my COD remittance short". A chatbot that answered questions would have been a FAQ with better manners. The bar was an assistant that finishes the task.

02Discovery

Shadowing support conversations produced a taxonomy: roughly seventy percent of queries mapped to twenty tool-shaped actions; the rest needed knowledge retrieval. That split defined the architecture — a tool-execution loop for actions, RAG over help content and seller data for the rest, and one conversational surface over both. A hackathon voice prototype (top-5, Azure OpenAI) proved the voice channel deserved to be first-class, not a gimmick.

03Architecture

CHAT UI STREAMED VOICE WEBRTC RT EDGE WS · SFU ORCHESTRATOR LLM TOOL LOOP ORDER APIS GUARDED WRITES KNOWLEDGE RAG INDEX AUDIT LOG EVERY TOOL CALL
// the loop that turns answers into actions
while (!turn.done) {
  const step = await model.stream({ messages, tools });
  if (step.toolCall) {
    // risky writes (refunds, cancellations) require confirm-first
    const result = await execute(step.toolCall, { confirm: isRisky(step) });
    messages.push(result);
  } else turn.done = true;
}

Tool-execution loop — simplified

04Engineering

  • Confirm-first writes. Reads execute silently; mutations render a preview card the seller approves. Trust was designed, not assumed.
  • One pipeline, two channels. Voice and chat share the orchestrator — voice adds STT partials in and sentence-chunked TTS out, nothing forks.
  • Retrieval with receipts. Every knowledge answer cites its source document inline; unverifiable answers are refused by policy.
  • Full audit trail. Every tool call is logged with inputs, outputs and the conversation that authorized it.

05Impact

10K+
Queries handled monthly
70%
Of intents resolved by tools, not text
2
Channels, one orchestration pipeline

06Lessons

The hard part of an agent isn't the loop — it's the social contract around writes. Preview cards and audit logs did more for adoption than any model upgrade. People don't adopt intelligence; they adopt accountability.