plate=https://github.com/pulumi/examples/aws-go-langserve)  
AWS  |  python  |  [ https://github.com/pulumi/examples/aws-py-langserve ](https://github.com/pulumi/examples/aws-py-langserve) |  [ ![Deploy](https://get.pulumi.com/new/button.svg) ](https://app.pulumi.com/new?template=https://github.com/pulumi/examples/aws-py-langserve)  
AWS  |  typescript  |  [ https://github.com/pulumi/examples/aws-ts-langserve ](https://github.com/pulumi/examples/aws-ts-langserve) |  [ ![Deploy](https://get.pulumi.com/new/button.svg) ](https://app.pulumi.com/new?template=https://github.com/pulumi/examples/aws-ts-langserve)  
AWS  |  javascript  |  [ https://github.com/pulumi/examples/aws-js-langserve ](https://github.com/pulumi/examples/aws-js-langserve) |  [ ![Deploy](https://get.pulumi.com/new/button.svg) ](https://app.pulumi.com/new?template=https://github.com/pulumi/examples/aws-js-langserve)  
  
###  Community Contributed  ​

####  Deploy to Railway  ​

[ Example Railway Repo ](https://github.com/PaulLockett/LangServe-
Railway/tree/main)

[ ![Deploy on Railway](https://railway.app/button.svg)
](https://railway.app/template/pW9tXP?referralCode=c-aq4K)

##  Pydantic  ​

LangServe provides support for Pydantic 2 with some limitations.

  1. OpenAPI docs will not be generated for invoke/batch/stream/stream_log when using Pydantic V2. Fast API does not support  [mixing pydantic v1 and v2 namespaces]  . 
  2. LangChain uses the v1 namespace in Pydantic v2. Please read the [ following guidelines to ensure compatibility with LangChain ](https://github.com/langchain-ai/langchain/discussions/9337)

Except for these limitations, we expect the API endpoints, the playground and
any other features to work as expected.

##  Advanced  ​

###  Handling Authentication  ​

If you need to add authentication to your server, please read Fast API's
documentation about [ dependencies
](https://fastapi.tiangolo.com/tutorial/dependencies/) and [ security
](https://fastapi.tiangolo.com/tutorial/security/) .

The below examples show how to wire up authentication logic LangServe
endpoints using FastAPI primitives.

You are responsible for providing the actual authentication logic, the users
table etc.

If you're not sure what you're doing, you could try using an existing solution
[ Auth0 ](https://auth0.com/) .

####  Using add_routes  ​

If you're using ` add_routes ` , see examples [ here
](https://github.com/langchain-ai/langserve/tree/main/examples/auth) .

Description  |  Links   
---|---  
**Auth** with ` add_routes ` : Simple authentication that can be applied across all endpoints associated with app. (Not useful on its own for implementing per user logic.)  |  [ server ](https://github.com/langchain-ai/langserve/tree/main/examples/auth/global_deps/server.py)  
**Auth** with ` add_routes ` : Simple authentication mechanism based on path dependencies. (No useful on its own for implementing per user logic.)  |  [ server ](https://github.com/langchain-ai/langserve/tree/main/examples/auth/path_dependencies/server.py)  
**Auth** with ` add_routes ` : Implement per user logic and auth for endpoints that use per request config modifier. ( **Note** : At the moment, does not integrate with OpenAPI docs.)  |  [ server ](https://github.com/langchain-ai/langserve/tree/main/examples/auth/per_req_config_modifier/server.py) , [ client ](https://github.com/langchain-ai/langserve/tree/main/examples/auth/per_req_config_modifier/client.ipynb)  
  
Alternatively, you can use FastAPI's [ middleware
](https://fastapi.tiangolo.com/tutorial/middleware/) .

Using global dependencies and path dependencies has the advantage that auth
will be properly supported in the OpenAPI docs page, but these are not
sufficient for implement per user logic (e.g., making an application that can
search only within user owned documents).

If you need to implement per user logic, you can use the `
per_req_config_modifier ` or ` APIHandler ` (below) to implement this logic.

**Per User**

If you need auth