The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
chore(infra): update PR template, agent files (#34104)
Mason Daugherty4c3800d7430a
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.mdindex 05105dbf74..41095e8534 100644--- a/.github/PULL_REQUEST_TEMPLATE.md+++ b/.github/PULL_REQUEST_TEMPLATE.md@@ -1,28 +1,30 @@(Replace this entire block of text)-Thank you for contributing to LangChain! Follow these steps to mark your pull request as ready for review. **If any of these steps are not completed, your PR will not be considered for review.**+Read the full contributing guidelines: https://docs.langchain.com/oss/python/contributing/overview++Thank you for contributing to LangChain! Follow these steps to have your pull request considered as ready for review.++1. PR title: Should follow the format: TYPE(SCOPE): DESCRIPTION-- [ ] **PR title**: Follows the format: {TYPE}({SCOPE}): {DESCRIPTION}- Examples:+ - fix(anthropic): resolve flag parsing error- feat(core): add multi-tenant support- - fix(cli): resolve flag parsing error- - docs(openai): update API usage examples- - Allowed `{TYPE}` values:- - feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert, release- - Allowed `{SCOPE}` values (optional):- - core, cli, langchain, standard-tests, text-splitters, docs, anthropic, chroma, deepseek, exa, fireworks, groq, huggingface, mistralai, nomic, ollama, openai, perplexity, prompty, qdrant, xai, infra- - Once you've written the title, please delete this checklist item; do not include it in the PR.+ - test(openai): update API usage tests+ - Allowed TYPE and SCOPE values: https://github.com/langchain-ai/langchain/blob/master/.github/workflows/pr_lint.yml#L15-L33++2. PR description:++ - Write 1-2 sentences summarizing the change.+ - If this PR addresses a specific issue, please include "Fixes #ISSUE_NUMBER" in the description to automatically close the issue when the PR is merged.+ - If there are any breaking changes, please clearly describe them.+ - If this PR depends on another PR being merged first, please include "Depends on #PR_NUMBER" inthe description.-- [ ] **PR message**: ***Delete this entire checklist*** and replace with- - **Description:** a description of the change. Include a [closing keyword](https://docs.github.com/en/issues/tracking-your-work-with-issues/using-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword) if applicable to a relevant issue.- - **Issue:** the issue # it fixes, if applicable (e.g. Fixes #123)- - **Dependencies:** any dependencies required for this change+3. Run `make format`, `make lint` and `make test` from the root of the package(s) you've modified.-- [ ] **Lint and test**: Run `make format`, `make lint` and `make test` from the root of the package(s) you've modified. **We will not consider a PR unless these three are passing in CI.** See [contribution guidelines](https://docs.langchain.com/oss/python/contributing) for more.+ - We will not consider a PR unless these three are passing in CI.Additional guidelines:-- Most PRs should not touch more than one package.-- Please do not add dependencies to `pyproject.toml` files (even optional ones) unless they are **required** for unit tests. Likewise, please do not update the `uv.lock` files unless you are adding a required dependency.-- Changes should be backwards compatible.-- Make sure optional dependencies are imported within a function.+ - We ask that if you use generative AI for your contribution, you include a disclaimer.+ - PRs should not touch more than one package unless absolutely necessary.+ - Do not update the `uv.lock` files unless or add dependencies to `pyproject.toml` files (even optional ones) unless you have explicit permission to do so by a maintainer.diff --git a/AGENTS.md b/AGENTS.mdindex 1e2b420aef..13b44c756b 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -324,3 +324,9 @@ Before submitting code changes:- [ ] **Code Quality**: `make lint` and `make format` pass- [ ] **Architecture**: Suggested improvements where applicable- [ ] **Commit Message**: Follows Conventional Commits format++## Pull request guidelines++- Describe the "why" of the changes, why the proposed solution is the right one.+- Highlight areas of the proposed changes that require careful review.+- Always add a disclaimer to the PR description mentioning how AI agents are involved with the contribution.diff --git a/CLAUDE.md b/CLAUDE.mdindex 1e2b420aef..c317064255 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -1,326 +1 @@-# Global Development Guidelines for LangChain Projects--## Core Development Principles--### 1. Maintain Stable Public Interfaces ⚠️ CRITICAL--**Always attempt to preserve function signatures, argument positions, and names for exported/public methods.**--❌ **Bad - Breaking Change:**--```python-def get_user(id, verbose=False): # Changed from `user_id`- pass-```--✅ **Good - Stable Interface:**--```python-def get_user(user_id: str, verbose: bool = False) -> User:- """Retrieve user by ID with optional verbose output."""- pass-```--**Before making ANY changes to public APIs:**--- Check if the function/class is exported in `__init__.py`-- Look for existing usage patterns in tests and examples-- Use keyword-only arguments for new parameters: `*, new_param: str = "default"`-- Mark experimental features clearly with docstring warnings (using MkDocs Material admonitions, like `!!! warning`)--🧠 *Ask yourself:* "Would this change break someone's code if they used it last week?"--### 2. Code Quality Standards--**All Python code MUST include type hints and return types.**--❌ **Bad:**--```python-def p(u, d):- return [x for x in u if x not in d]-```--✅ **Good:**--```python-def filter_unknown_users(users: list[str], known_users: set[str]) -> list[str]:- """Filter out users that are not in the known users set.-- Args:- users: List of user identifiers to filter.- known_users: Set of known/valid user identifiers.-- Returns:- List of users that are not in the known_users set.- """- return [user for user in users if user not in known_users]-```--**Style Requirements:**--- Use descriptive, **self-explanatory variable names**. Avoid overly short or cryptic identifiers.-- Attempt to break up complex functions (>20 lines) into smaller, focused functions where it makes sense-- Avoid unnecessary abstraction or premature optimization-- Follow existing patterns in the codebase you're modifying--### 3. Testing Requirements--**Every new feature or bugfix MUST be covered by unit tests.**--**Test Organization:**--- Unit tests: `tests/unit_tests/` (no network calls allowed)-- Integration tests: `tests/integration_tests/` (network calls permitted)-- Use `pytest` as the testing framework--**Test Quality Checklist:**--- [ ] Tests fail when your new logic is broken-- [ ] Happy path is covered-- [ ] Edge cases and error conditions are tested-- [ ] Use fixtures/mocks for external dependencies-- [ ] Tests are deterministic (no flaky tests)--Checklist questions:--- [ ] Does the test suite fail if your new logic is broken?-- [ ] Are all expected behaviors exercised (happy path, invalid input, etc)?-- [ ] Do tests use fixtures or mocks where needed?--```python-def test_filter_unknown_users():- """Test filtering unknown users from a list."""- users = ["alice", "bob", "charlie"]- known_users = {"alice", "bob"}-- result = filter_unknown_users(users, known_users)-- assert result == ["charlie"]- assert len(result) == 1-```--### 4. Security and Risk Assessment--**Security Checklist:**--- No `eval()`, `exec()`, or `pickle` on user-controlled input-- Proper exception handling (no bare `except:`) and use a `msg` variable for error messages-- Remove unreachable/commented code before committing-- Race conditions or resource leaks (file handles, sockets, threads).-- Ensure proper resource cleanup (file handles, connections)--❌ **Bad:**--```python-def load_config(path):- with open(path) as f:- return eval(f.read()) # ⚠️ Never eval config-```--✅ **Good:**--```python-import json--def load_config(path: str) -> dict:- with open(path) as f:- return json.load(f)-```--### 5. Documentation Standards--**Use Google-style docstrings with Args section for all public functions.**--❌ **Insufficient Documentation:**--```python-def send_email(to, msg):- """Send an email to a recipient."""-```--✅ **Complete Documentation:**--```python-def send_email(to: str, msg: str, *, priority: str = "normal") -> bool:- """- Send an email to a recipient with specified priority.-- Args:- to: The email address of the recipient.- msg: The message body to send.- priority: Email priority level (`'low'`, `'normal'`, `'high'`).-- Returns:- `True` if email was sent successfully, `False` otherwise.-- Raises:- `InvalidEmailError`: If the email address format is invalid.- `SMTPConnectionError`: If unable to connect to email server.- """-```--**Documentation Guidelines:**--- Types go in function signatures, NOT in docstrings- - If a default is present, DO NOT repeat it in the docstring unless there is post-processing or it is set conditionally.-- Focus on "why" rather than "what" in descriptions-- Document all parameters, return values, and exceptions-- Keep descriptions concise but clear-- Ensure American English spelling (e.g., "behavior", not "behaviour")--📌 *Tip:* Keep descriptions concise but clear. Only document return values if non-obvious.--### 6. Architectural Improvements--**When you encounter code that could be improved, suggest better designs:**--❌ **Poor Design:**--```python-def process_data(data, db_conn, email_client, logger):- # Function doing too many things- validated = validate_data(data)- result = db_conn.save(validated)- email_client.send_notification(result)- logger.log(f"Processed {len(data)} items")- return result-```--✅ **Better Design:**--```python-@dataclass-class ProcessingResult:- """Result of data processing operation."""- items_processed: int- success: bool- errors: List[str] = field(default_factory=list)--class DataProcessor:- """Handles data validation, storage, and notification."""-- def __init__(self, db_conn: Database, email_client: EmailClient):- self.db = db_conn- self.email = email_client-- def process(self, data: List[dict]) -> ProcessingResult:- """Process and store data with notifications."""- validated = self._validate_data(data)- result = self.db.save(validated)- self._notify_completion(result)- return result-```--**Design Improvement Areas:**--If there's a **cleaner**, **more scalable**, or **simpler** design, highlight it and suggest improvements that would:--- Reduce code duplication through shared utilities-- Make unit testing easier-- Improve separation of concerns (single responsibility)-- Make unit testing easier through dependency injection-- Add clarity without adding complexity-- Prefer dataclasses for structured data--## Development Tools & Commands--### Package Management--```bash-# Add package-uv add package-name--# Sync project dependencies-uv sync-uv lock-```--### Testing--```bash-# Run unit tests (no network)-make test--# Don't run integration tests, as API keys must be set--# Run specific test file-uv run --group test pytest tests/unit_tests/test_specific.py-```--### Code Quality--```bash-# Lint code-make lint--# Format code-make format--# Type checking-uv run --group lint mypy .-```--### Dependency Management Patterns--**Local Development Dependencies:**--```toml-[tool.uv.sources]-langchain-core = { path = "../core", editable = true }-langchain-tests = { path = "../standard-tests", editable = true }-```--**For tools, use the `@tool` decorator from `langchain_core.tools`:**--```python-from langchain_core.tools import tool--@tool-def search_database(query: str) -> str:- """Search the database for relevant information.-- Args:- query: The search query string.- """- # Implementation here- return results-```--## Commit Standards--**Use Conventional Commits format for PR titles:**--- `feat(core): add multi-tenant support`-- `fix(cli): resolve flag parsing error`-- `docs: update API usage examples`-- `docs(openai): update API usage examples`--## Framework-Specific Guidelines--- Follow the existing patterns in `langchain-core` for base abstractions-- Use `langchain_core.callbacks` for execution tracking-- Implement proper streaming support where applicable-- Avoid deprecated components like legacy `LLMChain`--### Partner Integrations--- Follow the established patterns in existing partner libraries-- Implement standard interfaces (`BaseChatModel`, `BaseEmbeddings`, etc.)-- Include comprehensive integration tests-- Document API key requirements and authentication-------## Quick Reference Checklist--Before submitting code changes:--- [ ] **Breaking Changes**: Verified no public API changes-- [ ] **Type Hints**: All functions have complete type annotations-- [ ] **Tests**: New functionality is fully tested-- [ ] **Security**: No dangerous patterns (eval, silent failures, etc.)-- [ ] **Documentation**: Google-style docstrings for public functions-- [ ] **Code Quality**: `make lint` and `make format` pass-- [ ] **Architecture**: Suggested improvements where applicable-- [ ] **Commit Message**: Follows Conventional Commits format+AGENTS.md