DSPy vs LangChain: frameworks compared
Updated By Agent Radar3 min read
Short answer
DSPy vs LangChain compared from repo metadata and docs: positioning, licenses, model-provider surfaces and what the sources leave unsaid.
Top pick: DSPy. DSPy is described in its repository as the framework for programming, not prompting, language models. The repository reports an MIT license.
DSPy and LangChain are both MIT-licensed open-source frameworks, but they describe themselves differently. DSPy is "the framework for programming—not prompting—language models", while LangChain calls itself "the agent engineering platform". Checked 2026-10-14 against repository metadata and LangChain's docs.
Quick comparison
| Tool | Best fit (from sources) | License | Pricing as stated | Primary source |
|---|---|---|---|---|
| DSPy | Programming language models rather than prompting them | MIT | not stated | GitHub |
| LangChain | Building agents with tools across many model providers | MIT | not stated | GitHub, docs |
How the options differ
Positioning
The DSPy repository describes the project as a framework for programming, not prompting, language models.
The LangChain repository describes itself as "The agent engineering platform". Its listed topics include agents, multiagent, langgraph, deepagents, rag and enterprise.
Surface shown in the sources
The LangChain docs overview shows a create_agent function that takes a model string, a list of tools and a system prompt, and is run with agent.invoke. The DSPy excerpts contain no code examples, so a side-by-side API comparison is not possible from the cited sources.
Model providers
The LangChain docs show create_agent examples with model strings for OpenAI, Google GenAI, Anthropic, OpenRouter, Fireworks, Baseten, Ollama, Azure OpenAI, AWS Bedrock and Hugging Face. Several of these use separate integration packages, such as langchain-openrouter, langchain-fireworks, langchain-ollama and langchain-aws. The DSPy excerpts do not state which providers it supports.
License and age
Both repositories report an MIT license through the GitHub API. The DSPy repository was created on 2023-01-09 and the LangChain repository on 2022-10-17.
How we compared
We read the GitHub repository metadata for both projects and the LangChain docs overview page, checked on 2026-10-14. We did not install, run or benchmark either framework, and we did not read DSPy's own documentation site.
For narrower LangChain comparisons, see Agno vs LangChain and Pydantic AI vs LangChain.
Limitations
The cited sources do not state pricing, hosted offerings, performance, benchmarks, user counts, DSPy's provider support or how either tool handles evaluation or optimization. The ordering of items here is editorial and not a verdict.
Browse the hubs for DSPy and LangChain, the Frameworks category, and the latest launches: DSPy 3.4.1 and langchain-anthropic 1.7.6.
The tools
In rank orderDSPy is described in its repository as the framework for programming, not prompting, language models. The repository reports an MIT license.
Pros
- Clear positioning around programming rather than prompting models
- MIT license reported by the GitHub API
Cons
- Provider support not stated in the cited sources
- Pricing not stated in the cited sources
LangChain describes itself as the agent engineering platform, and its docs show create_agent examples across many model providers. The repository reports an MIT license.
Pros
- Docs show many provider integrations for create_agent
- MIT license reported by the GitHub API
Cons
- Several providers use separate integration packages
- Pricing not stated in the cited sources
Questions
What is the main difference between DSPy and LangChain?
DSPy describes itself as a framework for programming, not prompting, language models. LangChain describes itself as the agent engineering platform.
Are DSPy and LangChain open source?
Both GitHub repositories report an MIT license through the GitHub API.
Which model providers does LangChain support?
Its docs show create_agent examples for OpenAI, Google GenAI, Anthropic, OpenRouter, Fireworks, Baseten, Ollama, Azure OpenAI, AWS Bedrock and Hugging Face. DSPy's provider support is not stated in the cited sources.
Is DSPy or LangChain cheaper?
Pricing is not stated in the cited sources for either project.
More guides
Agno vs Google ADK: agent frameworks compared
Agno vs Google ADK compared from repo metadata and docs: Agno runs agents as a service, ADK is a multi-language agent framework.
- Top pick
- Agno
- Read time
- 6 min
- Updated
Agno vs CrewAI: agent frameworks compared
Agno vs CrewAI compared from repo metadata and product sites: Agno's agent service and AgentOS layer versus CrewAI's enterprise build and runtime platform.
- Top pick
- Agno
- Read time
- 5 min
- Updated
Agno vs LangChain: agent frameworks compared
Agno vs LangChain compared from repo metadata and docs: Agno targets running agents as a service, LangChain a model-agnostic agent API.
- Top pick
- Agno
- Read time
- 3 min
- Updated
Agno vs LangGraph: agent frameworks compared
Agno vs LangGraph compared from repo metadata and docs: service layer for agents versus a durable orchestration runtime, checked 2026-10-14.
- Top pick
- Agno
- Read time
- 5 min
- Updated