DEV Community

Sami Ullah
Sami Ullah

Posted on

I built langctl — stop wasting 2 days on agent project scaffolding

Every LangGraph agent project I shipped started the same way:

  1. Set up a LangGraph Agent Server
  2. Scaffold a Next.js frontend
  3. Figure out CORS between them
  4. Hide API keys from the browser
  5. Write a proxy
  6. Wire up a dev command that runs both

Two days. Every single time. Before writing a single line of agent logic.

I got tired of it. So I built langctl.

The Solution

pip install langctl
langctl new my-agent
cd my-agent
langctl dev
Enter fullscreen mode Exit fullscreen mode

That's it. Agent + chat UI running at localhost:3000. No CORS. No exposed API keys.

What You Get

Backend:

  • LangGraph Agent Server on :2024
  • agent.yaml as single source of truth
  • Long-term memory on by default (SQLite or Postgres)
  • 25 model providers (OpenAI, Ollama, OpenRouter, any OpenAI-compatible)
  • Middleware pipeline: cost limits, tool retries, guardrails

Frontend:

  • LangChain's own agent-chat-ui on :3000
  • Built-in proxy — /api/agent/* routes to the agent server
  • Same origin = zero CORS
  • API keys stay server-side

All Commands

Command What it does
langctl new Scaffold backend + frontend
langctl dev Run both as one app, health-gated
langctl share Public tunnel for instant demos
langctl add Add tools, memory, middleware
langctl sync Regen langgraph.json from agent.yaml
langctl doctor Verify setup before failure

The Architecture

Browser → localhost:3000 (Next.js)
              ↓
         /api/agent/* (proxy)
              ↓
         127.0.0.1:2024 (LangGraph Agent Server)
Enter fullscreen mode Exit fullscreen mode

Same origin. The proxy attaches x-api-key server-side. Moving to production? Change one env variable.

Why Not Existing Templates?

LangChain has langchain-nextjs-template and agent-chat-ui. But:

  • They require manual CORS config
  • API keys sit in .env.local (frontend)
  • You run two separate dev servers
  • No memory, no middleware, no tunnel

langctl automates all of that into one command.

Install

pip install langctl
Enter fullscreen mode Exit fullscreen mode

Python 3.11+, Node.js 18+

GitHub: github.com/Sami606713/agent_cli
PyPI: pypi.org/project/langctl
License: Apache-2.0

15 releases in 4 days. PRs and feedback welcome.

Top comments (0)