temporalio / samples-python

Samples for working with the Temporal Python SDK
MIT License
126 stars 56 forks source link

[Feature Request] Example with LangGraph #146

Open nitin302 opened 2 weeks ago

nitin302 commented 2 weeks ago

Is your feature request related to a problem? Please describe.

How can we use temporal with LangGraph workflows - https://github.com/langchain-ai/langgraph? Could you give a example?

Describe the solution you'd like

LangGraph is typically used in agentic workflows and using temporal would give us the ability to scale execution.

Additional context

None

cretz commented 2 weeks ago

Temporal does not really care what technology you use inside the activities, but the scaling/distribution of workflows/activities is controlled by Temporal server. https://github.com/temporalio/samples-python/tree/main/langchain sample shows using LangChain in activities and you can do the same for invoking a LangGraph workflow inside an activity. But despite using the same term "workflow", Temporal workflows and LangGraph workflows are unrelated.

nitin302 commented 2 weeks ago

Yes, I understand that, but an example would be helpful.

cretz commented 2 weeks ago

Can you use the LangChain sample, but call LangGraph instead of a LangChain in the activity? (same for any third party library, not specific to LangChain/LangGraph)

nitin302 commented 2 weeks ago

Yes, but i am looking for how we can make LangGraph nodes/edges become workflows/activities to make it easier to understand... It would help folks building AI agents use temporal for scaling.

cretz commented 2 weeks ago

I don't think LangGraph nodes/edges become workflows/activities. I think you interact with the LangGraph library via an activity like interacting with any other library occurs via activity. LangGraph primitives don't integrate in a special way with Temporal ones from what I can see at a quick glance. If there are specific suggestions to how integration could/should occur, that may help.