LangChain
AGENTS.md1.1k starsChanged 17 days agoMITView on GitHub
This file provides guidance to Codex (Codex.ai/code) when working with code in this repository. C# implementation of the LangChain framework for building applications with LLMs through composability. Provides chains, memory, RAG (Retrieval-Augmented Generation), document loaders, text splitters, and a serving layer. Distributed as multiple NuGet packages under the LangChain namespace. The meta-package LangChain bundles the most commonly used providers (OpenAI, Anthropic, Google, Ollama, Azure, etc.) with the core library. Integration tests require API keys via environment variables (e.g., OPENAIAPIKEY). Tests…
- Reads credentials
We split this AGENTS.md into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 130
Strong naming: All assemblies signed with src/key.snk
≈ “Common” is an estimate: at least 1 in 5 of the 36,368 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
AGENTS.md
This file provides guidance to Codex (Codex.ai/code) when working with code in this repository.
Project Overview
C# implementation of the LangChain framework for building applications with LLMs through composability. Provides chains, memory, RAG (Retrieval-Augmented Generation), document loaders, text splitters, and a serving layer. Distributed as multiple NuGet packages under the LangChain namespace. The meta-package LangChain bundles the most commonly used providers (OpenAI, Anthropic, Google, Ollama, Azure, etc.) with the core library.
Build and Test Commands
# Build the entire solution
dotnet build LangChain.slnx
# Run all integration tests
dotnet test src/Meta/test/LangChain.IntegrationTests.csproj
# Run core unit tests
dotnet test src/Core/test/UnitTests/LangChain.Core.UnitTests.csproj
# Run splitter tests
dotnet test src/Splitters/Abstractions/test/LangChain.Splitters.Abstractions.Tests.csproj
# Run a specific test
dotnet test src/Meta/test/LangChain.IntegrationTests.csproj --filter "FullyQualifiedName~WikiTests"
# Validate trimming/NativeAOT compatibility
dotnet build src/Helpers/TrimmingHelper/TrimmingHelper.csprojIntegration tests require API keys via environment variables (e.g., OPENAI_API_KEY). Tests skip (not fail) if keys are unset.
Architecture
Project Structure
src/
├── Core/src/ # LangChain.Core — chains, memory, prompts, retrievers, schema
├── Meta/src/ # LangChain (meta-package) — bundles Core + popular providers
├── Meta/test/ # Integration tests (WikiTests, ReadmeTests)
├── DocumentLoaders/
│ ├── Abstractions/ # LangChain.DocumentLoaders.Abstractions
│ ├── Pdf/ # LangChain.DocumentLoaders.Pdf (PdfPig-based)
│ ├── WebBase/ # LangChain.DocumentLoaders.Html
│ └── Word/ # LangChain.DocumentLoaders.Word
├── Splitters/
│ ├── Abstractions/ # LangChain.Splitters.Abstractions (CharacterTextSplitter, etc.)
│ └── CSharp/ # LangChain.Splitters.CSharp
├── Extensions/
│ ├── DependencyInjection/ # LangChain.Extensions.DependencyInjection
│ └── Docker/ # LangChain.Extensions.Docker
├── Serve/
│ ├── Abstractions/ # LangChain.Serve.Abstractions
│ ├── src/ # LangChain.Serve (ASP.NET Core middleware)
│ └── OpenAI/ # LangChain.Serve.OpenAI (OpenAI-compatible serving)
├── Utilities/
│ ├── Pollyfils/ # LangChain.Polyfills (framework polyfills)
│ ├── Sql/ # LangChain.Utilities.Sql
│ └── Postgres/ # LangChain.Utilities.Postgres
├── Cli/ # LangChain.Cli
└── Providers/Abstractions/ # Local copy of provider abstractions (mirrors LangChain.Providers)
examples/ # Sample projects (OpenAI, Azure, Memory, Serve, LocalRAG, etc.)Core Abstractions (src/Core/src/)
Chains (Chains/):
Chainstatic class — fluent API for composing stackable chains using the|operator- Key chain factory methods:
Set(),Template(),LLM(),RetrieveSimilarDocuments(),CombineDocuments(),LoadMemory(),UpdateMemory(),TTS(),STT(),ReActAgentExecutor(),GroupChat() StackableChains/— individual chain implementations (LLM, ReAct agents, Crew agents, file chains, image generation)- Chains are composed via the pipe
|operator and executed withchain.RunAsync("key")
Memory (Memory/):
ConversationBufferMemory— stores full conversation historyConversationSummaryMemory— stores summarized conversation historyConversationSummaryBufferMemory— hybrid (recent messages + summarized history)ConversationWindowBufferMemory— sliding window of recent messages
Prompts (Prompts/):
- Prompt template system with variable substitution via
{variable_name}placeholders
Base Classes (Base/):
BaseChain— abstract base for all chainsBaseCallbackHandler— callback system for tracing and debugging
Dependencies
LangChain.Core depends on:
LangChain.Providers.Abstractions(NuGet) — provider interfaces (IChatModel, IEmbeddingModel)LangChain.Databases.Abstractions(NuGet) — database interfaces (IVectorDatabase, IVectorCollection)LangChain.DocumentLoaders.Abstractions(project reference)LangChain.Splitters.Abstractions(project reference)
The meta-package additionally references:
LangChain.Providers.OpenAI,LangChain.Providers.Anthropic,LangChain.Providers.Google,LangChain.Providers.Ollama,LangChain.Providers.Azure,LangChain.Providers.DeepSeek,LangChain.Providers.HuggingFaceLangChain.Databases.InMemory
Key Patterns
Chain Composition — the primary pattern for building LLM workflows:
var chain =
Set("question text")
| RetrieveSimilarDocuments(vectorCollection, embeddingModel, amount: 5)
| CombineDocuments(outputKey: "context")
| Template(promptTemplate)
| LLM(llm);
var result = await chain.RunAsync("text");Provider/Model Pattern — providers authenticate, models execute:
var provider = new OpenAiProvider(apiKey);
var llm = new OpenAiLatestFastChatModel(provider);
var embeddingModel = new TextEmbeddingV3SmallModel(provider);RAG Pattern — load documents, create embeddings, query with similarity search:
var vectorCollection = await vectorDatabase.AddDocumentsFromAsync<PdfPigPdfLoader>(
embeddingModel, dimensions: 1536, dataSource: DataSource.FromUrl(url));
var similarDocuments = await vectorCollection.GetSimilarDocuments(embeddingModel, question);Key Conventions
- Target frameworks:
net4.6.2,netstandard2.0,net8.0,net9.0 - Language: C# preview, nullable reference types enabled, implicit usings
- Strong naming: All assemblies signed with
src/key.snk - Versioning: MinVer with
vtag prefix - Testing: MSTest framework
- Central package management:
src/Directory.Packages.props - Cross-project dependencies between LangChain ecosystem repos are via NuGet packages, not project references
Trending
Quiet since August.about the whole repository
Who's talking about tryAGI/LangChain
- tryAGI/LangChain.Providers“Providers: OpenAI - Add all possible settings”GitHub · Mar 27, 2024 · 2 reactions
- tryAGI/LangChain.Providers“[OpenAI] Support for JSON Response Format”GitHub · Nov 27, 2023 · 2 reactions
- braintrustdata/braintrust-sdk-dotnet“[bot] Instrument tryAGI/LangChain (2,600 weekly downloads)”GitHub · Aug 24, 2026
- tryAGI/LangChain.Providers“build(deps): Bump the all group with 10 updates”GitHub · Feb 3, 2025
- tryAGI/LangChain.Databases“build(deps): Bump the all group with 3 updates”GitHub · Feb 3, 2025
The biggest 5 of 47 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 47
Talked about on GitHub (47 times).
On GitHub · 47
- Mar 27, 2024Providers: OpenAI - Add all possible settings — tryAGI/LangChain.Providers2 reactions · 1 comment
- Nov 27, 2023[OpenAI] Support for JSON Response Format — tryAGI/LangChain.Providers2 reactions
- Aug 24, 2026[bot] Instrument tryAGI/LangChain (2,600 weekly downloads) — braintrustdata/braintrust-sdk-dotnet0 reactions
- Feb 3, 2025build(deps): Bump the all group with 10 updates — tryAGI/LangChain.Providers0 reactions · 1 comment
- Feb 3, 2025build(deps): Bump the all group with 3 updates — tryAGI/LangChain.Databases0 reactions · 1 comment
42 more on GitHub
- Jan 6, 2025build(deps): Bump the all group with 10 updates — tryAGI/LangChain.Providers0 reactions · 1 comment
- Jan 6, 2025build(deps): Bump the all group with 5 updates — tryAGI/LangChain.Databases0 reactions · 1 comment
- Dec 11, 2024build(deps): Bump the all group with 3 updates — tryAGI/LangChain.Providers0 reactions · 1 comment
- Dec 11, 2024build(deps): Bump the all group with 3 updates — tryAGI/LangChain.Databases0 reactions · 1 comment
- Nov 13, 2024build(deps): Bump the all group with 4 updates — tryAGI/LangChain.Providers0 reactions · 1 comment
- Nov 4, 2024build(deps): Bump the all group with 3 updates — tryAGI/LangChain.Providers0 reactions · 1 comment
- Sep 20, 2024build(deps): Bump LangChain.DocumentLoaders.Abstractions from 0.15.1-dev.130 to 0.15.2 in the all group — tryAGI/LangChain.Databases0 reactions · 1 comment
- Sep 19, 2024build(deps): Bump the all group with 10 updates — tryAGI/LangChain.Providers0 reactions · 1 comment
- Sep 19, 2024build(deps): Bump the all group with 3 updates — tryAGI/LangChain.Databases0 reactions · 1 comment
- Sep 18, 2024build(deps): Bump the all group with 5 updates — tryAGI/LangChain.Providers0 reactions · 1 comment
- Sep 18, 2024build(deps): Bump the all group across 1 directory with 4 updates — tryAGI/LangChain.Databases0 reactions · 1 comment
- Sep 16, 2024build(deps): Bump the all group with 16 updates — tryAGI/LangChain.Providers0 reactions · 1 comment
- Sep 16, 2024build(deps): Bump the all group with 2 updates — tryAGI/LangChain.Databases0 reactions · 1 comment
- Sep 12, 2024build(deps): Bump the all group with 8 updates — tryAGI/LangChain.Providers0 reactions · 1 comment
- Sep 12, 2024build(deps): Bump the all group with 2 updates — tryAGI/LangChain.Databases0 reactions · 1 comment
- Sep 11, 2024build(deps): Bump the all group with 11 updates — tryAGI/LangChain.Providers0 reactions · 1 comment
- Sep 6, 2024build(deps): Bump the all group with 7 updates — tryAGI/LangChain.Providers0 reactions · 1 comment
- Sep 6, 2024build(deps): Bump the all group with 3 updates — tryAGI/LangChain.Databases0 reactions · 1 comment
- Sep 4, 2024build(deps): Bump the all group with 5 updates — tryAGI/LangChain.Providers0 reactions · 1 comment
- Sep 2, 2024build(deps): Bump the all group with 11 updates — tryAGI/LangChain.Providers0 reactions · 1 comment
- Sep 2, 2024build(deps): Bump the all group with 3 updates — tryAGI/LangChain.Databases0 reactions · 1 comment
- Aug 23, 2024build(deps): Bump the all group with 8 updates — tryAGI/LangChain.Providers0 reactions · 1 comment
- Aug 23, 2024build(deps): Bump the all group with 3 updates — tryAGI/LangChain.Databases0 reactions · 1 comment
- Aug 22, 2024build(deps): Bump the all group with 7 updates — tryAGI/LangChain.Providers0 reactions · 1 comment
- Aug 22, 2024build(deps): Bump the all group with 3 updates — tryAGI/LangChain.Databases0 reactions · 1 comment
- Aug 21, 2024build(deps): Bump the all group with 8 updates — tryAGI/LangChain.Providers0 reactions · 1 comment
- Aug 20, 2024build(deps): Bump the all group with 13 updates — tryAGI/LangChain.Providers0 reactions · 1 comment
- Aug 20, 2024build(deps): Bump the all group with 6 updates — tryAGI/LangChain.Databases0 reactions · 1 comment
- Aug 19, 2024build(deps): Bump the all group with 12 updates — tryAGI/LangChain.Providers0 reactions · 1 comment
- Aug 19, 2024build(deps): Bump the all group with 6 updates — tryAGI/LangChain.Databases0 reactions
- Aug 15, 2024build(deps): Bump the all group with 6 updates — tryAGI/LangChain.Providers0 reactions
- Aug 15, 2024build(deps): Bump LangChain.Serve.Abstractions from 0.15.1-dev.79 to 0.15.1-dev.86 in the all group — tryAGI/LangChain.Databases0 reactions
- Aug 14, 2024build(deps): Bump the all group with 10 updates — tryAGI/LangChain.Providers0 reactions
- Aug 7, 2024build(deps): Bump the all group with 6 updates — tryAGI/LangChain.Providers0 reactions
- Aug 7, 2024build(deps): Bump the all group with 3 updates — tryAGI/LangChain.Databases0 reactions
- Jul 31, 2024Embedding models for Together AI. — tryAGI/LangChain.Providers0 reactions
- Jul 24, 2024Bug: Missing TypeInfo — tryAGI/AutoSDK0 reactions
- May 11, 2024Update ollama-curated.yaml — davidmigloz/langchain_dart0 reactions · 3 comments
- May 7, 2024LangChain — Sarel-Esterhuizen/GroqSharp0 reactions
- Feb 15, 2024Visual Studio crashes when opening files — mrlacey/CollapseComments0 reactions · 11 comments
- Nov 21, 2023LICENSE — kallebysantos/dotnet-together.ai0 reactions · 1 comment
- Jun 8, 2023Optimizations — aiqinxuancai/TiktokenSharp0 reactions · 4 comments
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 28,693 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repositoryOne other file it gives its agents.
- CLAUDE.mdCLAUDE.md
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

