# LangEx v0.7.0 - Table of Contents

Graph-based agent orchestration for building stateful, multi-step LLM workflows with nodes, edges, conditional routing, state reducers, human-in-the-loop interrupts, and checkpointing. Inspired by LangGraph, built on BEAM primitives.

## Pages

- [LangEx](readme.md)
- [Changelog](changelog.md)

## Modules

- [LangEx](LangEx.md): LangEx — LangGraph for Elixir.
- [LangEx.Config](LangEx.Config.md): Layered configuration resolution for LangEx.
- [LangEx.ContextCompaction](LangEx.ContextCompaction.md): Manages context window size by compacting older tool-call rounds.
- [LangEx.Graph.NodeCache](LangEx.Graph.NodeCache.md): ETS-backed memoization for node results (the `cache:` node option).
- [LangEx.Graph.Pregel](LangEx.Graph.Pregel.md): Super-step execution engine inspired by Google's Pregel.
- [LangEx.Message.AI](LangEx.Message.AI.md): A message authored by the LLM, optionally carrying tool calls.
- [LangEx.Message.Human](LangEx.Message.Human.md): A message authored by the human user.
- [LangEx.Message.System](LangEx.Message.System.md): A system prompt message.
- [LangEx.Message.Tool](LangEx.Message.Tool.md): The result of a tool call, correlated by `tool_call_id`.
- [LangEx.Message.ToolCall](LangEx.Message.ToolCall.md): A structured tool/function call requested by the LLM.
- [LangEx.Prebuilt](LangEx.Prebuilt.md): Ready-made graph constructors for common agent shapes.
- [LangEx.Tool.Node.ToolCallRequest](LangEx.Tool.Node.ToolCallRequest.md): Tool execution request passed to `wrap_tool_call` interceptors.

- Graph
  - [LangEx.Graph](LangEx.Graph.md): StateGraph builder.
  - [LangEx.Graph.Compiled](LangEx.Graph.Compiled.md): A compiled, executable graph.
  - [LangEx.Graph.RetryPolicy](LangEx.Graph.RetryPolicy.md): Retry configuration for the `retry:` node option.
  - [LangEx.Graph.State](LangEx.Graph.State.md): State management with reducer support.
  - [LangEx.Graph.Stream](LangEx.Graph.Stream.md): Streaming graph execution.

- Control Flow
  - [LangEx.Command](LangEx.Command.md): Combines a state update with a routing directive.
Returned from node functions to both update state and control flow.
The `:resume` field is used to resume interrupted graphs.

  - [LangEx.Interrupt](LangEx.Interrupt.md): Pause graph execution and wait for external input.
  - [LangEx.Send](LangEx.Send.md): Directs execution to a node with a custom state payload.
Used for map-reduce patterns where the number of edges is dynamic.

- Errors
  - [LangEx.NodeError](LangEx.NodeError.md): Structured failure of a graph node.
  - [LangEx.NodeTimeoutError](LangEx.NodeTimeoutError.md): Raised when a node attempt exceeds its timeout.

- Checkpointing
  - [LangEx.Checkpoint](LangEx.Checkpoint.md): Data structure representing a saved graph execution snapshot.
  - [LangEx.Checkpoint.Serializer](LangEx.Checkpoint.Serializer.md): Lossless JSON-safe encoding for checkpoint payloads.
  - [LangEx.Checkpointer](LangEx.Checkpointer.md): Behaviour for checkpoint persistence backends.
  - [LangEx.Checkpointer.Memory](LangEx.Checkpointer.Memory.md): In-memory `LangEx.Checkpointer` backend.
  - [LangEx.Checkpointer.Postgres](LangEx.Checkpointer.Postgres.md): PostgreSQL-backed checkpointer using Ecto.
  - [LangEx.Checkpointer.Redis](LangEx.Checkpointer.Redis.md): Redis-backed checkpointer using Redix.
  - [LangEx.Migration](LangEx.Migration.md): Migrations create and modify the database tables LangEx needs to function.

- Store
  - [LangEx.Store](LangEx.Store.md): Long-term key-value memory that outlives a single thread.
  - [LangEx.Store.ETS](LangEx.Store.ETS.md): In-memory `LangEx.Store` backend.
  - [LangEx.Store.Postgres](LangEx.Store.Postgres.md): PostgreSQL-backed `LangEx.Store` using Ecto.

- Messages
  - [LangEx.Message](LangEx.Message.md): Chat message types for LLM interactions.
  - [LangEx.MessagesState](LangEx.MessagesState.md): Pre-built state schema with a `messages` key using the `add_messages` reducer.

- LLM
  - [LangEx.LLM](LangEx.LLM.md): Behaviour for LLM provider adapters.
  - [LangEx.LLM.Anthropic](LangEx.LLM.Anthropic.md): Streaming Anthropic Claude adapter with tool use, thinking, and prompt caching.
  - [LangEx.LLM.ChatModel](LangEx.LLM.ChatModel.md): Helper to create graph nodes that call an LLM.
  - [LangEx.LLM.Gemini](LangEx.LLM.Gemini.md): Google Gemini chat adapter with function calling support.
  - [LangEx.LLM.OpenAI](LangEx.LLM.OpenAI.md): OpenAI chat completions adapter with tool/function calling support.
  - [LangEx.LLM.Registry](LangEx.LLM.Registry.md): Provider registry and model resolver for LLM chat models.
  - [LangEx.LLM.Resilient](LangEx.LLM.Resilient.md): Retry-aware LLM wrapper with backoff, telemetry hooks, and fallback.

- Tools
  - [LangEx.Tool](LangEx.Tool.md): Provider-agnostic tool/function definition for LLM tool calling.
  - [LangEx.Tool.Annotation](LangEx.Tool.Annotation.md): Annotates tool results with error recovery guidance for the LLM.
  - [LangEx.Tool.Node](LangEx.Tool.Node.md): Graph node for executing tool calls from AI messages.

- Observability
  - [LangEx.Telemetry](LangEx.Telemetry.md): Telemetry events emitted by LangEx.
  - [LangEx.Telemetry.OpenTelemetryBridge](LangEx.Telemetry.OpenTelemetryBridge.md): Optional OpenTelemetry bridge for LangEx telemetry spans.
  - [LangEx.Telemetry.Runs](LangEx.Telemetry.Runs.md): Run-tree correlation for telemetry spans.

