Hi team, I am curious to know if we use langgraph ...
# flink-agents-dev
s
Hi team, I am curious to know if we use langgraph Agent in flink job - will that give me same features ?
Copy code
# Define LangGraph agent
  workflow = StateGraph(AgentState)
  workflow.add_node("agent", llm_node)
  workflow.add_node("tools", tool_node)
  workflow.compile()

  # Use in Flink
  class LangGraphOperator(MapFunction):
      def map(self, value):
          result = workflow.invoke({"messages": [value]})
          return result["messages"][-1]

  # Flink job
  env = StreamExecutionEnvironment.get_execution_environment()
  stream = env.from_source(...)
  stream.map(LangGraphOperator()).add_sink(...)
x
Depends on what do you need. Running a LangGraph Agent inside a flink map operator should work (I haven't tried though). But you won't have features like async execution, state/memory management, consistency guarantees.
BTW, could you please ask these kind of questions in the #C09KP5YUWE8 channel next time? We'd like to keep this channel for the development discussions only.
πŸ†— 1