Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

API reference

AI Agents API reference

AI agents, planning and tool use

Identifiers
119
With full guides
42
Types
3

Topics covered

  • What is an agent
  • The ReAct loop
  • Tool / function calling
  • Planning & memory
  • Multi-agent systems
  • LangGraph state machines
  • Guardrails & retries
  • Model Context Protocol (MCP)

Class

NameWhat it does
AgentClass
StateGraphStateGraph is the builder for stateful workflows whose nodes read shared state and return partial updates. Add nodes and edges, optionally configure reducers, then compile the graph before invoking it.
ToolNodeToolNode is a prebuilt LangGraph.js node that executes tool calls from an AIMessage. It supports graph message state and parallel execution, returning one ToolMessage per call.
MemorySaverMemorySaver is LangGraph.js's in-memory checkpointer for saving graph checkpoints by thread. It is useful for development and testing, but its state is lost when the process restarts.
CommandCommand lets a LangGraph node combine a state update with routing instructions. It can target ordinary nodes, Send-based execution, or a parent graph from a subgraph.
MessageGraphClass
RunnerClass
Tasktask wraps an asynchronous operation for use inside a LangGraph entrypoint or StateGraph. Its returned proxy produces promises, enabling checkpoint-aware execution and parallel task calls.
CrewClass
ProcessClass
FlowClass
SessionClass
RunContextWrapperClass
InputGuardrailClass
OutputGuardrailClass
FunctionToolClass
WebSearchToolClass
FileSearchToolClass
ComputerToolClass
ModelSettingsClass
RunResultClass
AgentHooksClass
RunHooksClass
AIMessageAIMessage represents an AI response in LangGraph.js. It can include content, typed tool calls, invalid tool calls, usage metadata, and an optional example marker.
HumanMessageHumanMessage represents a user's input in LangChain conversations. Create it with text or structured multimodal content and pass it to chat models or LangGraph state.
SystemMessageClass
ToolMessageClass
RunnableConfigRunnableConfig is the per-call configuration object for LangGraph runnables. It carries execution limits, tracing data, cancellation, runtime values, persistence, and custom-stream output settings.

Function

NameWhat it does
createReactAgentCreates a prebuilt ReAct agent graph from a language model and tools. The agent can invoke tools during a message-driven execution loop before returning a response.
interruptPauses execution of a graph node and exposes a value to the caller. When the graph is re-invoked with Command({ resume }), interrupt returns that resume value inside the node.
toolLangGraph's ToolNode executes tools within workflows and supports parallel calls, error handling, and state injection. It is useful when an agent needs controlled, graph-based tool execution.
createMcpClientFunction
create_react_agentFunction
add_nodeAdds a named node to a LangGraph.js StateGraph. The node implementation runs when graph execution reaches it and can return updates to the graph state.
add_edgeaddEdge adds an unconditional transition between LangGraph.js nodes. Use START and END to define entry and termination, then compile the builder.
add_conditional_edgesFunction
compileStateGraph.compile() validates a graph definition and produces the executable graph. It is also the place to configure runtime options such as checkpointers and breakpoints.
function_toolFunction
handoffHandoffs let tools change state so an agent can dynamically reconfigure itself or transfer control to another agent. They can be implemented with middleware for one agent or with separate agent subgraphs.
add_messagesaddMessages is a LangGraph reducer that combines an existing message list with incoming messages. It supports standard messages and special modifiers such as RemoveMessage.
trim_messagestrimMessages reduces a conversation history to fit an LLM's context window. Configure the retention strategy, token budget, and valid message boundaries before invoking the model.
entrypointentrypoint wraps an asynchronous function as a LangGraph workflow. It returns an executable Pregel instance and can be configured with a name, checkpointer, and runtime features.

Const

NameWhat it does
MessagesAnnotationMessagesAnnotation is a prebuilt LangGraph state annotation for accumulating messages across graph nodes. It supports standard messages and special modifiers such as RemoveMessage.
LangGraphConst
CrewAIConst
AutoGPTConst
AutoGenConst
OpenAI Agents SDKConst
MastraConst
LlamaIndex AgentsConst
Semantic KernelConst
SwarmConst
BabyAGIConst
MetaGPTConst
LettaConst
Pydantic AIConst
AgnoConst
smolagentsConst
Atomic AgentsConst
ReActConst
Tool CallingTool calling lets a LangGraph.js workflow execute tools selected by a model. ToolNode handles dispatch, parallel execution, and returns one ToolMessage per tool call.
Function CallingConst
PlanningConst
ReflectionConst
Short-term MemoryShort-term memory gives an agent thread-scoped state for maintaining multi-turn conversation history. A checkpointer persists that state so the same thread can continue across invocations.
Long-term MemoryLong-term memory stores user- or application-specific data across sessions and conversational threads. LangGraph saves it as JSON documents in a store, addressed by a custom namespace and key.
Episodic MemoryEpisodic memory captures past events and actions so an agent can remember how tasks were accomplished. It is commonly reused as few-shot examples that guide future task execution.
Working MemoryConst
ScratchpadConst
Chain-of-ThoughtConst
Tree of ThoughtsConst
Multi-Agent SystemConst
OrchestrationConst
Supervisor AgentcreateSupervisor builds a hierarchical multi-agent supervisor that routes tasks among specialized agents using handoff tools. Configure the supervisor model, managed agents, prompt, naming mode, output-history mode, and optional pre-model processing.
HandoffHandoffs use tools and state updates to change an agent's behavior or route execution to another agent. They can be implemented with middleware in one agent or with multiple agent subgraphs.
RoutingConst
Human-in-the-LoopConst
GuardrailsConst
RetrievalConst
Vector StoreConst
Semantic SearchSemantic search lets a LangGraph agent retrieve memory-store items by meaning rather than exact wording. Configure semantic indexing, then provide a natural-language query to the store.
Context Window ManagementConst
State ManagementState Management is LangGraph's shared-state model for agent workflows. Define a state schema, let nodes return partial updates, and use reducers to determine how updates are combined.
WorkflowConst
CheckpointCheckpoint is a point-in-time snapshot of LangGraph state. Checkpointers persist snapshots per thread, enabling memory, resumption, human-in-the-loop workflows, and recovery.
Interruptinterrupt pauses a graph node and exposes a value to the caller. Re-invoking the graph with Command and a resume value makes that value available as interrupt's result.
StreamingLangGraph's stream API lets applications observe graph execution as it happens. Select a stream mode to receive state changes, full state snapshots, LLM tokens, custom events, checkpoints, tasks, or debug events.
ObservabilityConst
TracingTracing records the steps an agent takes from input to output as LangSmith runs. Enable it with LangSmith environment variables to inspect execution and debug LangGraph applications.
EvaluationConst
Agent LoopConst
ActionConst
ObservationConst
ThoughtConst
EnvironmentConst
RewardConst
PolicyConst
STARTSTART is LangGraph.js's virtual beginning node. Use it to connect graph input to the node or nodes that should execute first.
ENDEND is LangGraph.js’s terminal graph node. Route an edge—typically a conditional edge—to END when execution should stop and no further node should run.
AnnotationAnnotation declares channels for StateGraph state. Use it directly for replacement semantics or configure a reducer to combine node updates.
SendSend routes execution to a named graph node with custom input state. Returning multiple Send objects from conditional edges enables dynamic fan-out and map-reduce workflows.
Model Context ProtocolConst
MCP ServerConst
MCP ClientConst
ResourcesConst
PromptsConst
ToolsTools are callable functions that let LangChain agents interact with external systems. A chat model chooses when to call a tool and supplies arguments according to its declared input schema.
SamplingConst
ToolkitConst
SubagentConst
Agent handoffsAgent handoffs use tools to update state and dynamically route behavior to another step or agent. The documentation presents middleware-based handoffs within one agent and subgraph-based handoffs between distinct agents.
Structured outputsStructured output lets a LangChain agent return validated data that conforms to a declared schema instead of free-form text. The result is available in the final state’s structuredResponse field.
Streaming eventsstreamEvents exposes an asynchronous stream of runnable lifecycle events while a graph executes. Each event identifies its type, source runnable, and execution ID, enabling real-time progress handling and selective filtering.
Tracing spansConst
Lifecycle hooksConst
Max turnsConst
Tool choicetool_choice controls whether a model must call a bound tool. In the JavaScript workflow, tool_choice: "any" forces a tool call for a dedicated agent step.
Parallel tool callsToolNode executes the tools requested by the latest AIMessage. Multiple requested tools run in parallel, and the node returns one ToolMessage for each call.
Context objectContext is static, per-run information made available to an agent through its Runtime. Define its shape with contextSchema, pass values via the invocation context option, and access them in tools or middleware.

Search across every package and filter by type in your dashboard.

Start learning