CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-langchain--langgraph

Low-level orchestration framework for building stateful, multi-actor applications with LLMs

Overview
Eval results
Files

multi-agent.mddocs/guides/

Multi-Agent Systems Guide

Orchestrating multiple specialized agents.

Supervisor Pattern

const State = Annotation.Root({
  messages: Annotation<BaseMessage[]>({
    reducer: messagesStateReducer,
    default: () => []
  }),
  next: Annotation<string>()
});

const supervisorNode = async (state: State) => {
  const lastMessage = state.messages[state.messages.length - 1];

  // Decide which agent to route to
  let next = "finish";
  if (needsResearch(lastMessage)) next = "researcher";
  else if (needsCoding(lastMessage)) next = "coder";

  return { next };
};

const router = (state: State) => state.next;

graph
  .addNode("supervisor", supervisorNode)
  .addNode("researcher", researchAgent)
  .addNode("coder", coderAgent)
  .addEdge(START, "supervisor")
  .addConditionalEdges("supervisor", router, {
    researcher: "researcher",
    coder: "coder",
    finish: END
  })
  .addEdge("researcher", "supervisor")
  .addEdge("coder", "supervisor");

Parallel Agents with Aggregation

const State = Annotation.Root({
  query: Annotation<string>,
  results: Annotation<Record<string, any>>({
    reducer: (a, b) => ({ ...a, ...b }),
    default: () => ({})
  })
});

graph
  .addNode("agent1", (s) => ({ results: { agent1: process1(s.query) } }))
  .addNode("agent2", (s) => ({ results: { agent2: process2(s.query) } }))
  .addNode("aggregate", aggregateNode)
  .addEdge(START, "agent1")
  .addEdge(START, "agent2")
  .addEdge("agent1", "aggregate")
  .addEdge("agent2", "aggregate");

See: Common Patterns for more agent patterns.

Install with Tessl CLI

npx tessl i tessl/npm-langchain--langgraph@1.0.1

docs

index.md

tile.json