Every LangGraph agent project I shipped started the same way:
- Set up a LangGraph Agent Server
- Scaffold a Next.js frontend
- Figure out CORS between them
- Hide API keys from the browser
- Write a proxy
- 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
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.yamlas 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-uion: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)
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
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)