langchain-litellm
AGENTS.md62 starsChanged 7 days agoMITView on GitHub
langchain-litellm is the LangChain integration for LiteLLM: chat models, embeddings and an OCR document loader that reach any provider litellm supports. This file is the shared context for every coding agent. People start at CONTRIBUTING.md. Before writing a commit message, PR title, PR description or branch name, or adding or removing a label, read .claude/skills/conventional-commits/SKILL.md. Run from the repo root with uv 0.12.22 or later. Do not update uv.lock or add dependencies to pyproject.toml without explicit maintainer permission.
- Reads credentials
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 31,542 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 repository2 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- conventional-commitsSkill
The file
We split this AGENTS.md into the rules it gives an agent
5 rules. About 0 are common, 3 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 5
Before writing a commit message, PR title, PR description or branch name, or adding or removing a label, read …
- Distinctive: line 19
Run from the repo root with uv 0.12.22 or later.
- Very specific: line 34
Do not update uv.lock or add dependencies to pyproject.toml without explicit maintainer permission.
- Distinctive: line 44
Keep issue and PR numbers out of code comments and docstrings.
- Distinctive: line 45
Update docstrings in the same PR as the behaviour they describe.
≈ “Common” is an estimate: at least 1 in 5 of the 40,246 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
langchain-litellm is the LangChain integration for LiteLLM: chat models, embeddings and an OCR document loader that reach any provider litellm supports. This file is the shared context for every coding agent. People start at CONTRIBUTING.md.
Before writing a commit message, PR title, PR description or branch name, or adding or removing a label, read .claude/skills/conventional-commits/SKILL.md.
Layout
langchain_litellm/chat_models/litellm.py:ChatLiteLLM.langchain_litellm/chat_models/litellm_router.py:ChatLiteLLMRouter, a subclass that overrides_generate,_agenerate,_streamand_astream.langchain_litellm/embeddings/:LiteLLMEmbeddingsandLiteLLMEmbeddingsRouter.langchain_litellm/document_loaders/litellm_ocr.py:LiteLLMOCRLoader.tests/unit_tests/: offline; pytest-socket blocks the network.tests/integration_tests/: real provider calls.scripts/: the import check, the dependency-floor pins and the release-notes check that CI runs.
Commands
Run from the repo root with uv 0.12.22 or later.
make setupruns once per clone:uv sync, the pre-commit and pre-push hooks, and agit blamethat skips the bulk reformat commits.uv syncinstalls every dependency group into.venv, on the Python.python-versionnames, which CI lints with.make testruns the unit tests with network sockets blocked.make test TEST_FILE=<path>runs any pytest path.make test_matrixruns the unit tests on every Python version the classifiers inpyproject.tomllist, as CI's matrix does.make lintrunsruff check,ruff format --diffand mypy over the whole tree. This is the typecheck.make formatrunsruff check --fix --exit-zeroandruff format. It passes even when unfixable lint errors remain, so runmake lintafter it.make spell_checkruns codespell with the config inpyproject.toml.make check_importsimports every module underlangchain_litellm.uv lock --checkchecks the lockfile, as CI does.uv run pre-commit run --all-filesruns every commit hook on the whole tree.make checkruns what CI runs on a PR, in CI's order, except the dependency-floor and newest-litellm jobs.make integration_testsneeds network access and provider credentials in.env, whose variable names.env.examplelists. CI does not run it.
Do not update uv.lock or add dependencies to pyproject.toml without explicit maintainer permission.
Traps
ChatLiteLLMRouteroverrides all four entry points ofChatLiteLLM, so a fix to one of them usually needs the same fix in the router. Read both files.- Streaming and non-streaming responses convert tool calls in separate code paths. Change both.
- A parameter the caller did not set must be absent from the request, not sent as
None. Some providers reject the key whatever its value. - Unit tests never touch the network. Mock litellm, and pass
mock_responseon each call: the constructor drops it, and the request then reaches the real provider. - CI also runs the unit tests with every runtime dependency at the lowest version
pyproject.tomlallows, so code that reads a field only recent litellm releases set must pass there too. - The classifiers in
pyproject.tomlare the one list of supported Python versions: CI's matrices andmake test_matrixread them, and.python-versionmust name the lowest. A pre-commit hook checks that.python-version, the lowest classifier and therequires-pythonfloor agree. - Keep issue and PR numbers out of code comments and docstrings.
- Update docstrings in the same PR as the behaviour they describe. User-facing guides belong in the LangChain docs repository, not in
README.md. - release-please writes
CHANGELOG.mdand the version numbers. Do not edit them.
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.

