Migration Overview
Migrate existing LangChain or OpenRouter chained LLM code to managed Noukai flows — only when explicitly requested.
Activation rule: Only begin migration when the user has explicitly asked to migrate their LangChain, LangGraph, or OpenRouter chained LLM code to Noukai. Never suggest migration proactively. If the user is building new flows from scratch, use the Quickstart or noukai-prompt.md instead.
What Migration Does
Migration converts existing chained LLM calls — whether built with LangChain, LangGraph, or raw OpenAI/OpenRouter SDK — into managed Noukai flows. Each chain becomes a versioned, observable flow callable via a single API URL.
Migration does NOT:
- Delete or replace existing code (until the user explicitly says "implement")
- Modify or delete existing Noukai flows (only creates new ones)
- Require a Noukai SDK (uses HTTP calls to the slug execution API)
Prerequisites
Before starting migration, the user needs:
- A Noukai account with an organization and project created — see Quickstart
- An API key — see Managing API Keys
- For MCP-assisted creation: Noukai MCP configured in their AI assistant — see MCP Setup
The Four Phases
Migration follows four phases. Each requires user approval before moving to the next.
Phase 1: Audit & Design
Scan the codebase, identify all chained LLM call sites, trace their data flow, and propose equivalent Noukai flows with structural improvement notes.
Read: Audit & Design Protocol
Also read the relevant pattern reference:
- LangChain Patterns — if the codebase uses
langchain,langgraph, orlangchain_coreimports - OpenRouter Patterns — if the codebase uses raw
openaioropenrouterSDK calls
Phase 2: Create & Test
Build the approved flows in Noukai via MCP tools. Create test cases, publish versions, and provide test URLs for the user to verify.
Read: Create & Test Protocol
Phase 3: Integrate
Add Noukai API calls alongside existing code, controlled by an environment variable switch. No existing code is removed or replaced.
Read: Integration Protocol
Phase 4: Decommission (User-Driven)
Once the user is satisfied with the Noukai flows in production, they can remove the old LangChain/OpenRouter code at their own pace. This phase is entirely user-driven — do not automate it.
Summary Table
| Phase | Entry Condition | Output | User Gate |
|---|---|---|---|
| Audit & Design | User says "migrate" | Migration plan table | "Does this plan look right?" |
| Create & Test | User approves plan | Live flows + test URLs | "Ready to integrate?" |
| Integrate | User says "implement" or "continue" | Side-by-side code with env switch | "Switch USE_NOUKAI=true to test" |
| Decommission | User decides | Old code removed | User-driven, no AI action |