Workshop examples from the Devscale AI Product Engineering bootcamp, built with the @anvia SDK. Each file demonstrates one core agentic building block on top of an OpenAI-compatible chat API.
| File | Pattern | What it does |
|---|---|---|
src/index.ts |
Chat loop with memory | Interactive CLI chat: model selector, full conversation history kept in a messages array, streamed tokens (reasoning + text deltas) |
src/01-pipeline.ts |
Multi-step pipeline | Pipeline with typed steps (generate search queries → web search), visualized with @anvia/studio |
src/02-routing.ts |
Routing | Classify a user request (billing / technical / general) with a Zod-validated structured output, then dispatch to a specialized prompt |
src/03-grounding.ts |
Grounding | Classify whether the request needs realtime data; if so, run a Tavily web search and inject the results as context before answering |
src/05-fanin-fanout.ts |
Fan-in / fan-out | Review a startup idea from three perspectives (business, product, market), then fan the results into a single final CEO review |
Shared helpers live in src/service.ts (query generation, Tavily search),
src/service2.ts (review prompts), and src/models.ts (OpenAI-compatible client).
- Node.js with pnpm (the project pins pnpm via
devEngines) - An OpenAI-compatible API key — the examples use OpenRouter
- A Tavily API key for the search-dependent examples
(
01-pipeline.ts,03-grounding.ts)
pnpm install
cp .env.example .env
# fill in OPENAI_API_KEY and TAVILY_API_KEY in .envThere are no npm scripts; each example runs directly with tsx:
pnpm tsx src/index.ts # interactive chat loop
pnpm tsx src/01-pipeline.ts # pipeline + Studio visualization
pnpm tsx src/02-routing.ts # routing
pnpm tsx src/03-grounding.ts # grounding with web search
pnpm tsx src/05-fanin-fanout.ts # fan-in / fan-out reviews@anvia/core— completions, pipelines, structured output@anvia/openai— OpenAI-compatible client@anvia/studio— pipeline visualizationzod— output schemas@tavily/core— web searchtsx+ TypeScript (strict, ESM)