Back

langchain #34584

chore(langchain): improve typing of agent decorators

by cbornet · Feb 06, 2026 at 19:31 UTC · scan-f13c611e8f057a10

Low Risk (15%)

Get this automatically on every PR

Install the Axiomo GitHub App to get Signals as check runs and PR comments on every pull request.

Install App

Risk Assessment

Risk level: Low (15%)

Risk Drivers

  • missing_tests: Added 86 lines of code but only 0 lines of tests

Intent

4/4 criteria met

Improve typing of agent decorators in langchain.

Acceptance Criteria

  • Fix typing of async functions for @wrap_model_call and @wrap_tool_call

    Changes show adjustments to handle async typing correctly using new type aliases.

  • Use type aliases instead of protocols

    Diff removes protocol usage and introduces type aliases, aligning with open/close principle.

  • Remove useless generics

    Diff shows deleted lines with unnecessary generics.

  • Use cast when mypy can't narrow the type

    The changes use cast for complex unions where type narrowing was previously an issue.

Confidence: 95.0% Source: diff analysis AI: openai

Contributors

cbornet PR Author 1 commit + Trusted
Account Age: 3972 days
Prior PRs: 442
Merged: 398

Trusted contributor with 398 merged PRs. maintains 129 public repositories. has 177 followers.

Evidence

Evidence Completeness: 80.0%
ci_passing Passing
tests_passing Passing
lint_passing Passing
build_successful Passing
Missing: security_scan_clean, coverage_maintained

Supply Chain

None Risk
Modifies dependencies
Modifies lockfile
Modifies CI config
Modifies build scripts

Focus Files

Review 1 high-priority file(s)

libs/langchain_v1/langchain/agents/middleware/types.py +173

173 lines changed; Source code

high

Triage

24

minutes to review

medium

effort level

none

staleness risk

Standard review process

Recommendation

APPROVE 83.0% readiness

Good evidence, acceptable risk, ready for merge

Next Steps

Question

Why is security_scan_clean missing? Consider adding this check.

Question

Why is coverage_maintained missing? Consider adding this check.