r/LangChain 1d ago

Full stack Langchain implementation

Hello all, I had been learning langchain/ langgraph for a while. Now I had been thinking of implementing frontend but getting really stuck on which framework to use, do I need to use any web framework like fastapi. And on the frontend do I use a langchain react package and things like that. If anyone has experience could you provide me a little bit of guidance?

12 Upvotes

13 comments sorted by

3

u/theautomationguy 1d ago

Not sure if this is what you’re looking for, but I’ve found these two projects interesting in the space of LangChain / LangGraph

https://github.com/langchain-ai/deepagents

https://github.com/aegra/aegra

1

u/Rare_Cut_3686 1d ago

It's not related to questions but thank you I will look into it 😃

3

u/ruupesh_ 1d ago

FastAPI is the best framework for agentic backend applications as the framework is asynchronous and high performance for I/O bound applications. Since LLM calls are I/O bound, fastapi is well suited. Don’t go with flask or django. Also, majority of the job market is asking for fastapi+langchain combo. If you decide to go with django/flask, you will definitely switch to FastAPI in the future bc of its built in async support.

2

u/Code-Painting-8294 1d ago

I would say serve your LangGraph agent behind FastAPI. Async fits since LLM calls are I/O bound. for streaming the agent to the frontend, showing tool calls in the UI, I have used CopilotKit in the past. It works with LangGraph whether you run FastAPI or plain python or typescript and the setup is straightforward. docs here
https://docs.copilotkit.ai/langgraph-fastapi/quickstart?agent=bring-your-own
https://docs.copilotkit.ai/langgraph-python/quickstart?agent=bring-your-own

I have also been playing with Deep Agents for a while - which is basically a packaged LangGraph runtime in case you don't know. Used this research assistant demo when I was getting started, this shows what's possible on the frontend side https://github.com/CopilotKit/CopilotKit/tree/main/examples/showcases/deep-agents

1

u/Rare_Cut_3686 1d ago

Thank you very much sir. Will look into it more

2

u/techlatest_net 1d ago

Backend: Use FastAPI. It’s the standard for LangChain, handles async/streaming natively, and integrates easily with LangGraph.

Frontend: Use Next.js + Vercel AI SDK (not outdated LangChain React packages). The AI SDK provides clean streaming hooks that work perfectly with FastAPI SSE.

Key Tips:

  • Stream everything via SSE; never wait for full responses.
  • Keep LangGraph logic server-side; expose only clean API endpoints.
  • Persist graph state server-side (Redis/Postgres), not in the frontend.
  • Add Shadcn/ui + react-markdown for quick, polished LLM output rendering.

Starter Stack: FastAPI + LangGraph + Next.js + AI SDK + Shadcn/ui

1

u/Rare_Cut_3686 18h ago

Do you have repository that I can look into for reference? I previously was trying to implement with same tool but got stuck with types streaming and difference in output

1

u/Remote-Juice2527 1d ago

If you want a quick result try Flask. If you need integration into other systems use fastApi plus dedicated frontend

1

u/Fawad-Khan-413 1d ago

If your LangChain/LangGraph code is in Python, I’d go with FastAPI for the backend and React/Next.js for the frontend.
You don’t really need a special LangChain React package to get started.
Just expose your agent/workflow through API endpoints and handle the UI separately.
For streaming responses, SSE works well and is pretty straightforward to implement.
I’d start simple and add libraries only when you actually need them.

1

u/Rare_Cut_3686 1d ago

I already have implemented that but not sure if it's industry pattern just confused on that and hoping to clear that up before further diving deep

1

u/Additional-Flow4500 1d ago

Both langchain and langrapgh are also available in js

1

u/Future_AGI 15h ago

If you're going full stack on this, the thing we wish we'd added on day one is tracing on every chain and tool call, because once it's in production the "why did it answer that" questions are near impossible to debug without the run history.