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
| Name | What it does |
|---|---|
Agent | |
StateGraph | StateGraph 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. |
ToolNode | ToolNode 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. |
MemorySaver | MemorySaver 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. |
Command | Command 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. |
MessageGraph | |
Runner | |
Task | task 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. |
Crew | |
Process | |
Flow | |
Session | |
RunContextWrapper | |
InputGuardrail | |
OutputGuardrail | |
FunctionTool | |
WebSearchTool | |
FileSearchTool | |
ComputerTool | |
ModelSettings | |
RunResult | |
AgentHooks | |
RunHooks | |
AIMessage | AIMessage represents an AI response in LangGraph.js. It can include content, typed tool calls, invalid tool calls, usage metadata, and an optional example marker. |
HumanMessage | HumanMessage 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. |
SystemMessage | |
ToolMessage | |
RunnableConfig | RunnableConfig 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
| Name | What it does |
|---|---|
createReactAgent | Creates 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. |
interrupt | Pauses 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. |
tool | LangGraph'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. |
createMcpClient | |
create_react_agent | |
add_node | Adds 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_edge | addEdge adds an unconditional transition between LangGraph.js nodes. Use START and END to define entry and termination, then compile the builder. |
add_conditional_edges | |
compile | StateGraph.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_tool | |
handoff | Handoffs 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_messages | addMessages is a LangGraph reducer that combines an existing message list with incoming messages. It supports standard messages and special modifiers such as RemoveMessage. |
trim_messages | trimMessages 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. |
entrypoint | entrypoint 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
| Name | What it does |
|---|---|
MessagesAnnotation | MessagesAnnotation is a prebuilt LangGraph state annotation for accumulating messages across graph nodes. It supports standard messages and special modifiers such as RemoveMessage. |
LangGraph | |
CrewAI | |
AutoGPT | |
AutoGen | |
OpenAI Agents SDK | |
Mastra | |
LlamaIndex Agents | |
Semantic Kernel | |
Swarm | |
BabyAGI | |
MetaGPT | |
Letta | |
Pydantic AI | |
Agno | |
smolagents | |
Atomic Agents | |
ReAct | |
Tool Calling | Tool 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 Calling | |
Planning | |
Reflection | |
Short-term Memory | Short-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 Memory | Long-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 Memory | Episodic 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 Memory | |
Scratchpad | |
Chain-of-Thought | |
Tree of Thoughts | |
Multi-Agent System | |
Orchestration | |
Supervisor Agent | createSupervisor 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. |
Handoff | Handoffs 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. |
Routing | |
Human-in-the-Loop | |
Guardrails | |
Retrieval | |
Vector Store | |
Semantic Search | Semantic 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 Management | |
State Management | State 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. |
Workflow | |
Checkpoint | Checkpoint is a point-in-time snapshot of LangGraph state. Checkpointers persist snapshots per thread, enabling memory, resumption, human-in-the-loop workflows, and recovery. |
Interrupt | interrupt 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. |
Streaming | LangGraph'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. |
Observability | |
Tracing | Tracing 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. |
Evaluation | |
Agent Loop | |
Action | |
Observation | |
Thought | |
Environment | |
Reward | |
Policy | |
START | START is LangGraph.js's virtual beginning node. Use it to connect graph input to the node or nodes that should execute first. |
END | END 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. |
Annotation | Annotation declares channels for StateGraph state. Use it directly for replacement semantics or configure a reducer to combine node updates. |
Send | Send 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 Protocol | |
MCP Server | |
MCP Client | |
Resources | |
Prompts | |
Tools | Tools 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. |
Sampling | |
Toolkit | |
Subagent | |
Agent handoffs | Agent 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 outputs | Structured 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 events | streamEvents 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 spans | |
Lifecycle hooks | |
Max turns | |
Tool choice | tool_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 calls | ToolNode executes the tools requested by the latest AIMessage. Multiple requested tools run in parallel, and the node returns one ToolMessage for each call. |
Context object | Context 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