Building an AI Co-Pilot Application: Patterns and Best Practices

thoughtworks · Consulting · 2023 · source Agentic: yes · promotional bias: low · source-backed · extracted with prompt 0.5.6 (schema v2)

Generated from extraction.json — do not edit by hand. Every claim cites verbatim source evidence; stated means the quote directly asserts the claim, implied means it supports it indirectly.

Problem

Domain: AI co-pilot product design

Thoughtworks wanted to understand how to build LLM-powered co-pilot applications that mediate between users and models instead of exposing a plain chat interface.

Constraints:

Architecture

Boba is a web co-pilot that sits between users and GPT-3.5/4. The frontend captures product-strategy inputs; the backend uses LangChain prompt templates, structured JSON responses, streaming, user-selected context, vector-store retrieval, web search, and image generation to support product ideation workflows.

Diagram confidence: reconstructed (reconstructed from prose).

flowchart LR
  boba_web_frontend["Boba web frontend"] --> backend_orchestration_service["Backend orchestration service"]
  backend_orchestration_service --> prompt_templates["Prompt templates"]
  prompt_templates --> openai_gpt_models["OpenAI GPT models"]
  backend_orchestration_service --> vector_store["Vector store"]
  external_knowledge_apis["External knowledge APIs"] --> vector_store
  vector_store --> backend_orchestration_service
  backend_orchestration_service --> streaming_progress_channel["Streaming progress channel"]
  streaming_progress_channel --> boba_web_frontend
  backend_orchestration_service --> image_generation_service["Image generation service"]
Drag to pan · scroll or use +/− to zoom · reconstructed from the source's described component topology

Components

Component Role Interacts with
Boba web frontend Captures user inputs, selections, and context for product ideation workflows. Backend orchestration service, Streaming progress channel
Backend orchestration service Coordinates prompt templates, model calls, structured parsing, and retrieval. Boba web frontend, Prompt templates, OpenAI GPT models, Vector store, External knowledge APIs, Image generation service
Prompt templates Enrich short user inputs with role, scenario, and domain context. Backend orchestration service, OpenAI GPT models
OpenAI GPT models Generate structured product strategy and ideation outputs. Backend orchestration service, Prompt templates
Vector store Stores embeddings for external knowledge retrieval. Backend orchestration service, External knowledge APIs
External knowledge APIs Bring web search and article content into the co-pilot. Backend orchestration service, Vector store
Streaming progress channel Improves UX by showing real-time generation progress. Boba web frontend, Backend orchestration service
Image generation service Generates storyboard illustrations. Backend orchestration service

Data flow

A user enters product-strategy intent and UI selections. Boba enriches that input through templates and persona instructions, calls GPT models, parses structured JSON responses, streams progress to the UI, carries selected context forward, and optionally retrieves external knowledge through embeddings, vector search, and web/article APIs.

3 supporting quotes
“The application mediates interactions between human users and OpenAI's GPT-3.5/4 models, adding UI elements and prompt orchestration logic”summary, stated
“Using LangChain's templating capabilities (similar to JavaScript templating engines like Nunjucks or Handlebars), the team built prompt templates”summary, stated
“Vector Store: HNSWLib (Hierarchical Navigable Small World) for in-memory vector similarity search”summary, stated

Why this architecture

The architecture turns LLM access into a product-specific co-pilot by adding UI affordances, templates, structured outputs, retrieval, and context-carrying patterns around the base model.

“designed to augment product strategy and generative ideation processes.”summary, stated
“help users who may not be skilled prompt engineers get better results from the underlying LLM.”summary, stated

Models used: GPT-3.5 · GPT-4 · OpenAI Embeddings · Stable Diffusion

Scale

Alternatives considered (roads not taken)

Simple user prompt passthrough

Rejected because: The team enriched short user inputs with templates, persona, and UI-controlled context.

“The first pattern addresses the need to enrich simple user inputs with additional context and structure before sending them to the LLM.”summary, stated

Free-form model output only

Rejected because: Production applications need structured data that can be parsed and rendered.

“Almost all production LLM applications need to parse LLM output into structured data for further processing.”summary, stated

Rely only on model pretraining

Rejected because: The team added embedded external knowledge with RAG to overcome knowledge cutoff limits.

“Embedded External Knowledge using RAG techniques.”summary, stated

Patterns

prompt-versioning (prompt design)

Boba uses prompt templates as reusable artifacts for different product strategy workflows.

“the team built prompt templates that incorporate user selections from the UI along with domain-specific context.”summary, stated

structured-output-contract (output parsing)

The system asks GPT to return well-formed JSON for downstream UI and processing.

“The team focused on getting GPT to return well-formed JSON and reported being "quite surprised by how well and consistently GPT returns well-formed JSON”summary, stated

rag-retrieval (external knowledge)

The co-pilot integrates external knowledge through embeddings, vector stores, web search, and article extraction.

“• External APIs: Google SERP API for web search, Extract API for article content retrieval”summary, stated

human-in-the-loop-gate (user steering)

The UI lets users select and carry context forward rather than letting the model autonomously decide all context.

“Select and Carry Context, Contextual Conversation, Out-Loud Thinking, Iterative Response”summary, stated

Tradeoffs

Build application-specific mediation around GPT.

Chose A co-pilot with templates, structured responses, context carrying, and retrieval over A generic chat wrapper around the model.

Rationale: Users need workflow support and domain context, not just model access.

“understanding how to build LLM-powered generative applications that go beyond simple chat interfaces.”summary, stated

Keep prompt templates simple.

Chose Different template files for substantially different use cases over Complex conditional logic inside templates.

Rationale: Simple templates are easier to reason about and maintain.

“keeping templates simple and avoiding complex conditional logic within templates — instead using different template files for substantially different use cases.”summary, stated

Gotchas (what bit them)

Production co-pilots are mostly product engineering, not only prompt engineering.

Root cause: The usable application needs UI, context controls, streaming, parsing, and workflow design around the model.

Resolution: Treat the model as one component in a product-specific co-pilot architecture.

“approximately 80% of effort went into user interface development, while only 20% went into the AI/prompt engineering aspects.”summary, stated

Structured response quality depends on prompting examples and schema clarity.

Root cause: The model needs enough output-shape context to produce parseable JSON.

Resolution: Describe schemas in prompts and provide few-shot output examples.

“Few-shot prompting with examples: Providing complete examples of the expected output format, which they found helped the LLM "think" in the right context”summary, stated

Evaluation

The case evaluates Boba through documented design patterns and practical implementation observations rather than a benchmark; the strongest quantitative observation is engineering effort allocation.

Metrics: Eight documented co-pilot patterns. · Approximately 80% UI effort and 20% AI/prompt engineering effort.

“The project identified eight key patterns for mediating conversations between users and LLMs”summary, stated
“approximately 80% of effort went into user interface development, while only 20% went into the AI/prompt engineering aspects.”summary, stated

Outcomes

This is an experimental co-pilot case; the main quantified scale fact is development effort allocation.

“developed an experimental AI co-pilot called "Boba" designed to augment product strategy and generative ideation processes.”summary, stated
“the application demonstrated practical approaches to prompt engineering, JSON response parsing, streaming responses for UX improvement”summary, stated