ix icon indicating copy to clipboard operation
ix copied to clipboard

LangGraph State Machines

Open kreneskyp opened this issue 1 year ago • 0 comments

Description

This PR adds State Machine component that compiles into a LangGraph state machine. State machines may be used to create custom agent components and to create collaborative flows. LCEL provide parallel and linear flows, and LangGraph provides looping, state, and branching.

State machines are composed of:

  • Schema: JSON Schema that defines state object
  • Action: optional runnable that executes on each iterations
  • Conditional: runnable that receives result of the action and decides the next step

TODO: DIAGRAM

State Machine integrates into standard LCEL based flows seamlessly. The branches may contain most combinations of graphs. Chains will compile into a combination of LangGraph and LCEL automatically.

example: State machine that coordinates with two worker agents.

image

Changes

[List out the changes you've made in this pull request. Be as specific as possible.]

How Tested

[Explain how you tested this pull request. Include any relevant steps or scripts.]

TODOs

  • [x] a few more unit test scenarios to write.
  • [x] graph parser isn't detecting an ImplicitJoin that spans state machine branches.
  • [x] add END component + parsing updates.
  • [ ] add descriptions to each skill / chain.
  • [ ] consider how to improve the select box to choose chains, agents, and skills in a single select.
  • [ ] ~BranchNode loop mapping: auto-map loop logic for when not all BranchNode branches end in a loop~

kreneskyp avatar Feb 17 '24 02:02 kreneskyp