agentleFS
tryAGItryAGI/LangChain/AGENTS.md

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
  1. Very specific:

    Strong naming: All assemblies signed with src/key.snk

    line 130

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

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.csproj

Integration 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/):

  • Chain static 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 with chain.RunAsync("key")

Memory (Memory/):

  • ConversationBufferMemory — stores full conversation history
  • ConversationSummaryMemory — stores summarized conversation history
  • ConversationSummaryBufferMemory — 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 chains
  • BaseCallbackHandler — 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.HuggingFace
  • LangChain.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 v tag 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

Download now (ZIP)

Trending

Quiet since August.about the whole repository

Dec 2025: 0 mentionsJan 2026: 0 mentionsFeb 2026: 0 mentionsMar 2026: 0 mentionsApr 2026: 0 mentionsMay 2026: 0 mentionsJun 2026: 0 mentionsJul 2026: 0 mentionsAug 2026: 1 mentionSep 2026: 0 mentionsOct 2026: 0 mentionsNov 2026: 0 mentions
Dec 2025Jun 2026Nov 2026
Mentions a month of the tryAGI/LangChain repository that our weekly crawl found. There is no adoption data for this file yet.

Who's talking about tryAGI/LangChain

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

42 more on GitHub
  • 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.

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.