U8 · Secondary

AgentLab — agent architecture lab

A study lab where I test agent architectures. Users build agents with their own Anthropic or OpenAI key and can switch on a mode that runs a 5-node LangGraph graph, showing each step live and sending traces to Langfuse.

Screens

AgentLab — agent architecture lab: screens 1
AgentLab — agent architecture lab: screens 2
AgentLab — agent architecture lab: screens 3

Engineering decisions

  • LangGraph graph with conditional routing: it classifies intent and chooses between calling tools, retrieving context or answering directly. A validation node asks for a new answer up to 2 times if the first one fails.
  • Lab panel inside the chat: per-node execution log with timings, a graph diagram that highlights the active node, and a link to the Langfuse trace, all streamed over SSE.
  • Multi-provider BYOK: Anthropic and OpenAI keys are encrypted with AES-256-GCM before they hit the database. The model list is fetched from each provider's API.
  • Two execution paths: regular chat runs through the Vercel AI SDK in Next.js; lab mode runs in a separate Python (FastAPI) service. The user's key never reaches the browser.
  • 4-layer input sanitization against prompt injection (Unicode normalization, regex, base64 payload detection and special-character ratio).
  • Built from 12 per-feature specs (spec-driven development), using Claude Code.

Results

  • Public MIT-licensed code, with specs and docs for architecture, BYOK, auth and the database in the repo.

Stack

Next.js 15TypeScriptPythonFastAPILangGraphVercel AI SDKPrismaPostgreSQLLangfuseDocker

What it shows

It's where I try out agent patterns (routing, tool use, self-validation, observability) in a full app before using them in client work.