An Elixir LangChain-style framework that connects Elixir applications to cloud and self-hosted chat models, agents, and tools.
Overview
LangChain for Elixir lets Elixir applications integrate AI services and locally hosted models. It targets developers who want to chain LLM calls with app code, data sources, and external services in a functional Elixir style, without aiming for full parity with the JavaScript or Python LangChain libraries.
The library wraps many chat providers, including Anthropic Claude, OpenAI ChatGPT and the Responses API, Google Gemini and Vertex AI, DeepSeek, Mistral, Perplexity, xAI Grok, Ollama, Bumblebee via Nx, AWS Bedrock and Mantle, and OpenAI-compatible endpoints such as Groq, OpenRouter, vLLM, and Cloudflare Workers AI. Central workflows revolve around LLMChain, with modular components, ready-made chains, tool calling, streaming, and multimodal content parts.
Developers can expose custom Elixir functions to models, use prompt caching where providers support it, run agents with trajectory capture for regression testing, and integrate observability via telemetry. Configuration uses Elixir runtime config and API keys for providers; HTTP calls go through the Req library.
Compared with the original LangChain ecosystems, this Elixir edition follows how the JavaScript library interacted with models while adapting to functional design and conversational LLM APIs rather than older history-preservation patterns.
Key features
- Unified chat model adapters
- LLMChain orchestration
- Tool and function calling
- OpenAI-compatible client module
- Bumblebee self-hosted models via Nx
- Agent trajectory testing utilities
- Multimodal message content parts
- Streaming and thinking content deltas
Use cases
- Chat agents inside Elixir apps
- Calling cloud or local LLM APIs
- Tool-augmented assistant workflows
- Testing agent tool-call sequences