llama-stack-mirror/docs/source/building_applications/langchain_langgraph/index.md
gabemontero 20fd5ff54c docs: add an AI frameworks with common OpenAI API compatibility section to AI Application Examples
This change attempts to build off of the existing "Agents vs. OpenAI Responses API" section of "AI Application Examples", and get into how several of the popular AI frameworks provide some form of OpenAI API compatibility, and how this fact can allow one to deploy such application on Llama Stack.

This change also
- introduces a simple LangChain/LangGraph example that runs on LLama Stack via use of OpenAI API compatibility API
- circles back to the Responses API, and introduces a page of external references to examples
- makes it clear that other OpenAI API compatibile AI frameworks can be added as the community has time to dive into them.
2025-09-18 17:32:33 -04:00

1.7 KiB

OpenAI, LangChain, and LangGraph via Llama Stack

One popular AI framework that exposes Open AI API compatibility is LangChain, with its OpenAI Provider.

With LangChain's OpenAI API compatibility, and using the Llama Stack OpenAI-compatible endpoint URL (http://localhost:8321/v1/openapi/v1, for example, if you are running Llama Stack locally) as the Open AI API provider, you can run your existing LangChain AI applications in your Llama Stack environment.

There is also LangGraph, an associated by separate extension to the LangChain framework, to consider. While LangChain is excellent for creating linear sequences of operations (chains), LangGraph allows for more dynamic workflows (graphs) with loops, branching, and persistent state. This makes LangGraph ideal for sophisticated agent-based systems where the flow of control is not predetermined. You can use your existing LangChain components in combination with LangGraph components to create more complex, multi-agent applications.

As this LangChain/LangGraph section of the Llama Stack docs iterates and expands, a variety of samples that vary both in

  • How complex the application is
  • What aspects of Llama Stack are leveraged in conjunction with the application

will be provided, as well as references to third party sites with samples.

Local examples:

  • Starter: Explore a simple, graph-based agentic application that exposes a simple tool to add numbers together.

External sites:

  • Responses: A deeper dive into the newer OpenAI Responses API (vs. the Chat Completion API).
:hidden:
:maxdepth: 1

langchain_langgraph
more_on_responses