Skip to main content
Connic
Back to BlogTutorial

Migrate from LangChain to Production AI Agents

A working LangChain prototype still needs to handle real traffic. Migrate existing agent code to a production-grade platform without rewriting from scratch.

March 23, 2026(last updated: July 19, 2026)11 min readAuthor: Connic Engineering

A LangChain prototype can impress stakeholders and succeed in a demo. The next question is when it can ship to real users.

That's when things get complicated. Moving a framework project to production means solving problems around isolated execution, concurrency control, deployment pipelines, observability, cost tracking, and retries. Connic puts those layers around an agent so the team can focus on the product instead of building a platform.

This guide walks through migrating an existing LangChain or ADK project to Connic, a managed platform that handles the production concerns for the team. Reusable Python tool logic usually stays the same; the structure around it changes.

Why Teams Outgrow Frameworks

LangChain, CrewAI, and Google ADK are agent frameworks. They provide abstractions for defining agents, tools, and chains. LangChain now also offers LangSmith Deployment, a managed runtime with observability and evaluation. Connic is the alternative for teams that want declarative agents, plain Python tools, managed connectors, guardrails, approvals, cost tracking, and deployment in one workflow.

Connic removes the following work from the production backlog around agent code:

No Deployment Story
A Python script still needs Docker, Kubernetes, load balancers, health checks, and rolling deployments. Our platform provides the managed runtime.
No Built-In Observability
When an agent fails at 2am, the team needs traces, logs, and token-level cost breakdowns. Connic records every model call and tool invocation automatically.
No Integration Infrastructure
An agent may need to trigger from webhooks, process emails, listen to message queues, and write results back to APIs. Connic supplies those managed connectors.
No Safety Controls
Prompt injection, PII leakage, cost runaway, infinite loops. Production agents need guardrails, iteration limits, and concurrency controls. Our platform makes them part of the runtime.

The migration does not abandon existing agent logic. It moves that logic into an environment that handles production concerns instead of requiring a platform build from scratch.

Move a LangChain agent to production

Existing agent code gains deployment, observability, and connectors without a rewrite.

Get started free

Further reading: AI agent deployment platforms, observability.

What Changes (and What Does Not)

The important thing to understand: plain Python tool logic is usually reusable. A function that queries a database is still a Python function that queries that database. What changes is how agents are defined and how the project is structured.

LangChain / ADKConnicChange Required
Agent defined in Python codeAgent defined in YAMLStructure change
Tools as decorated functionsTools as plain Python functionsRemove decorators
Model in constructor argsModel in YAML configMove to config
System prompt in Python stringSystem prompt in YAMLMove to config
Tool business logicPlain Python tool logicUsually reusable
LangSmith tracingBuilt-in tracesRemove superseded integration
Custom deployment scriptsGit push or CLI deployRemove scripts

Before and After

A LangChain support agent with two tools provides a concrete example.

Before: LangChain
from langchain_openai import ChatOpenAI
from langchain.agents import create_react_agent
from langchain.tools import tool

@tool
def search_docs(query: str) -> str:
    """Search the documentation for relevant articles."""
    # Your search logic here
    return results

@tool
def create_ticket(summary: str, priority: str) -> str:
    """Create a support ticket in the system."""
    # Your ticket creation logic here
    return ticket_id

llm = ChatOpenAI(model="gpt-4o")
agent = create_react_agent(
    llm=llm,
    tools=[search_docs, create_ticket],
    prompt="You are a customer support agent..."
)

After migration, this becomes two files: a YAML config and a tools module.

After: agents/support.yaml
version: "1.0"
name: support-agent
description: "Handles customer support queries"
model: connic/gpt-5.6-terra  # or openai/gpt-5-mini with OpenAI BYOK configured
system_prompt: |
  You are a customer support agent. Search the docs first,
  then create a ticket if the issue cannot be resolved.
tools:
  - support.search_docs
  - support.create_ticket
retry_options:
  attempts: 3
  initial_delay: 10
  max_delay: 30
After: tools/support.py
def search_docs(query: str) -> str:
    """Search the documentation for relevant articles."""
    # Same logic as before - no changes needed
    return results

def create_ticket(summary: str, priority: str) -> str:
    """Create a support ticket in the system."""
    # Same logic as before - no changes needed
    return ticket_id

Notice what happened: the tool functions are identical. Decorators are gone, the model and prompt moved to YAML, and the agent definition is now declarative configuration instead of imperative code.

What Teams Gain Immediately
That YAML config adds retry handling, deployment pipelines, execution traces, token tracking, and cost monitoring without writing a single line of infrastructure code. The agent deploys with a git push or connic deploy.

Automated Migration with the CLI

For projects with many agents and tools, the Connic CLI includes a migrate command that automates the structural conversion. It scans the project's Python code, extracts agents and tools, and generates a Connic project with the correct structure.

Terminal
$ pip install connic

$ connic migrate --source ./my-langchain-project --dest ./my-connic-project

  Scanning source project...
  Framework: langchain
  Agents found: 3
  Tools found: 8

  Generated Connic project in ./my-connic-project
  Running validation...

  Migration complete
    Project: ./my-connic-project
    Report:  ./my-connic-project/MIGRATION_REPORT.md

The CLI automates the structural work:

Agent Extraction
Finds agent definitions in the code, extracts system prompts, model names, and tool references, and generates YAML configuration files.
Tool Preservation
Extracts tool functions with their dependencies. Removes framework decorators. Resolves cross-file imports so the tools work standalone.
Model Normalization
Converts model references to the standard provider/model format. ChatOpenAI("gpt-4o") becomes openai/gpt-4o. The model string can then be updated to any current model such as openai/gpt-5-mini.
Migration Report
Generates a detailed report listing everything that was migrated and everything that needs manual review, so the remaining work is explicit.

What Migrates Automatically vs. Manually

Some parts require manual migration. The realistic breakdown is:

Automatic

  • Agent definitions (create_agent, create_react_agent, LlmAgent, SequentialAgent)
  • Tool functions (decorators stripped, logic preserved)
  • System prompts extracted from function arguments
  • Model name detection and normalization
  • Cross-file imports and tool dependencies
  • Requirements.txt generation from source dependencies

Manual Review Required

  • Complex orchestration workflows: LangGraph state graphs, parallel execution, and conditional routing need to be restructured as sequential agents or custom tool logic
  • RAG pipelines: retrieval chains should be converted to use the built-in retrieval or reimplemented as tools
  • State and memory: checkpointers and custom stores should be replaced with persistent sessions or the managed database
  • Callbacks and hooks: framework callbacks should be converted to middleware
  • Tracing integrations: remove LangSmith or custom tracing code once built-in Connic observability replaces it
The Migration Report Is the Roadmap
The CLI generates a MIGRATION_REPORT.md that lists every agent migrated, every tool extracted, and every item that needs manual attention. Treat it as a checklist. Work through it item by item, run connic lint after each change, and the report will show when the work is complete.

The Connic Project Structure

After migration, the project follows a clean, opinionated structure. The same structure applies to migrated and new projects:

Project Structure
my-project/
ā”œā”€ā”€ agents/              # YAML agent configurations
│   ā”œā”€ā”€ support.yaml
│   └── classifier.yaml
ā”œā”€ā”€ tools/               # Python tool functions
│   ā”œā”€ā”€ support.py
│   └── classify.py
ā”œā”€ā”€ middleware/           # Before/after hooks
ā”œā”€ā”€ guardrails/          # Custom safety checks
ā”œā”€ā”€ schemas/             # Output schemas
└── requirements.txt     # Dependencies

The key difference from framework projects: configuration is separated from logic. Agent definitions are declarative YAML, tool logic is plain Python. No framework boilerplate, no runner scripts, no deployment configuration to maintain.

What Teams Get After Migration

Once a project is migrated, our platform handles the production concerns:

Git-Based Deploys
Push to the repository and the platform builds and deploys automatically. Support for GitHub, GitLab, and Bitbucket. Or use connic deploy from the CLI.
Development and Tests
Run connic dev for a cloud-backed development runner with hot-reload. Use connic test for declarative suites in tests/, and lint first to catch configuration errors.
Connectors
Trigger agents from sources such as webhooks, Kafka, SQS, Stripe events, and email. Deliver results through supported outbound connectors without hosting the consumer.
Instant Rollbacks
Every deployment is versioned. If something breaks, roll back to the previous version with one click and without redeploying.

Step-by-Step Migration Checklist

Whether a team uses the automated CLI or migrates manually, the process looks like this:

  1. Run the migration: connic migrate --source ./your-project --dest ./connic-project

  2. Read the migration report. Address every follow-up item in MIGRATION_REPORT.md

  3. Verify agent configs. Open each YAML file in agents/ and confirm the system prompt, model, and tool references

  4. Check tool imports. Make sure functions in tools/ have all their dependencies

  5. Remove framework code. Delete superseded LangSmith integrations, custom runners, and deployment scripts

  6. Restructure complex patterns. Convert RAG pipelines to retrieval tools, callbacks to middleware, state to sessions

  7. Develop and test. Run connic lint, iterate with connic dev, and run connic test if the project has a declarative test suite

  8. Deploy. Run connic deploy or push to the connected Git repository

What Changes After Migration

Migrating from LangChain or ADK does not require rewriting the agents. Reusable tool logic usually stays the same. What changes is the infrastructure around it: deployment, observability, retries, guardrails, and integrations that Connic supplies from the first run.

The automated CLI handles the structural conversion and the migration report identifies what still needs manual attention. Complex graphs, persistence, retrieval, and external integrations naturally need more review, but the work starts from a converted project instead of a blank one.

For detailed migration guides, check the LangChain migration docs or the ADK migration docs. For a new project, the quickstart guide shows the end-to-end setup.

More from the Blog

Tutorial

Expose the Invoice Processor Template as an MCP Tool

Deploy Connic's invoice template as an MCP tool, discover it from Python, send invoice text, and check the extracted fields with a complete client example.

September 11, 202610 min read
Tutorial

How to Trigger AI Agents from Kafka Topics

Point a Connic Kafka inbound connector at a topic and every message starts an agent run. Configure the connector, link an agent, deploy, and watch runs.

July 12, 20268 min read
Tutorial

How Small Engineering Teams Can Add an AI Agent to SaaS

A practical, step-by-step path to shipping a first production AI agent with a small team: scope one job, define it in config, connect it to existing systems, and let a runtime handle the rest.

June 12, 20269 min read
Tutorial

Automated Agent Scoring: AI Agent Evaluation with LLM Judges

Automated agent scoring uses an LLM judge to grade sampled or every matching agent run against defined criteria. Track score trends and alert on regressions.

March 29, 202610 min read
Tutorial

Database vs Retrieval vs Sessions: Agent Memory Compared

A comparison of Connic's Database, Retrieval, and persistent sessions, including identity, TTL, sanitized events, and runs matched to that identity.

March 4, 202612 min read
Tutorial

AI Agents: From Prototype to Production

A demo works great until 1,000 concurrent users arrive. A practical guide to the production requirements most teams find out about too late.

January 10, 202610 min read
Tutorial

Hidden Costs of Self-Hosting AI Agents

We'll just deploy it on Kubernetes. Famous last words. The true cost of self-hosting AI agents versus a managed platform.

December 18, 20257 min read
Tutorial

AI Agents in SaaS Without an ML Team

Customers expect AI features even when a product team has no ML engineers. See how teams ship AI agents using skills they already have.

December 5, 20258 min read
Tutorial

AI Agent RAG Tutorial: Retrieval With Citations

Build a production RAG agent with scoped retrieval namespaces, read-only permissions, source citations, custom tool wrappers, and regression tests.

November 15, 20259 min read