langgraph.json (for example, a Starlette app in Python or a Hono app in Javascript).
Defining a custom app object lets you add any routes you’d like, so you can do anything from adding a /login endpoint to writing an entire full-stack web-app, all deployed in a single Agent Server.
Below are examples for Python and Javascript.
Create app
Starting from an existing LangSmith application, add the following custom route code to your app file. If you are starting from scratch, you can create a new app from a template using the CLI.- Python
- Javascript
Configure langgraph.json
Add the following to your langgraph.json configuration file. Make sure the path points to the app instance you created in the previous section.
- Python
- Javascript
Start server
Test the server out locally:- Python
- Javascript
localhost:2024/hello in your browser (2024 is the default development port), you should see the /hello endpoint returning a JSON response.
Shadowing default endpoints
The routes you create in the app are given priority over the system defaults, meaning you can shadow and redefine the behavior of any default endpoint.
Deploying
You can deploy this app as-is to LangSmith or to your self-hosted platform.Next steps
Now that you’ve added a custom route to your deployment, you can use this same technique to further customize how your server behaves, such as defining custom middleware and custom lifespan events.Connect these docs to Claude, VSCode, and more via MCP for real-time answers.

