fix: plumb through generics for create_deep_agent - #2383
Merged
Conversation
Merging this PR will not alter performance
Comparing Footnotes
|
| name: str | None = None, | ||
| cache: BaseCache | None = None, | ||
| ) -> CompiledStateGraph: | ||
| ) -> CompiledStateGraph[AgentState[ResponseT], ContextT, _InputAgentState, _OutputAgentState[ResponseT]]: # ty: ignore[invalid-type-arguments] # ty can't verify generic TypedDicts satisfy StateLike bound |
Collaborator
Author
There was a problem hiding this comment.
we should probably remove these hacks in LG, they don't type check well, the bound doesn't make that much sense
Collaborator
Author
There was a problem hiding this comment.
also context should probably default to Any, but alas here we are
Eugene Yurtsev (eyurtsev)
approved these changes
Apr 1, 2026
create_deep_agentcreate_deep_agent
Co-Authored-By: Pawel Twardziak <pawel-twardziak@users.noreply.github.com>
This was referenced Apr 1, 2026
james8814
pushed a commit
to james8814/deepagents
that referenced
this pull request
May 1, 2026
building off of langchain-ai#1779 will assign co-author credit to @pawel-twardziak, thank you!! --------- Co-authored-by: Pawel Twardziak <pawel-twardziak@users.noreply.github.com>
james8814
pushed a commit
to james8814/deepagents
that referenced
this pull request
May 1, 2026
Merges upstream-sync-round11 into master. Key upstream changes: - fix: remove legacy subagents API (langchain-ai#2443) — backward-compat shim retained - fix: inherit parent interrupt_on for subagents (langchain-ai#2334) - fix: plumb through generics for create_deep_agent (langchain-ai#2383) - fix: improvements in sandbox.write/read (langchain-ai#2321) - fix(acp): block dangerous shell patterns (langchain-ai#2308) - chore: update unset logic (langchain-ai#2435) - feat(evals): auto-regenerate eval catalog (langchain-ai#2432) - Various evals CI improvements, deps bumps (aiohttp, anthropic, litellm) Local fixes: - Restore local enhancements (logging, stream_writer, skills_allowlist, _EXCLUDED_STATE_KEYS expansion) - Manual langchain>=1.2.15 dependency extraction (version kept at 0.5.0) - Regenerate EVAL_CATALOG.md Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> # Conflicts: # libs/acp/deepagents_acp/server.py # libs/acp/uv.lock # libs/deepagents/deepagents/middleware/subagents.py
19 tasks
Mason Daugherty (mdrxy)
added a commit
that referenced
this pull request
Jul 7, 2026
) Closes #4051 --- `create_deep_agent` declared its `middleware` parameter as a bare `Sequence[AgentMiddleware]`. That pins `ContextT` to `None`, so type checkers reject context-aware middleware such as `AgentMiddleware[AgentState, Context]` even when a matching `context_schema` is passed. PR #2383 threaded `ContextT` through `context_schema` and the return type but missed `middleware`. This types it as `Sequence[AgentMiddleware[StateT_co, ContextT]]`, mirroring upstream `langchain.agents.create_agent`, so the inferred context type is preserved. `StateT_co` is imported from `langchain.agents.middleware.types`. A type-level regression test runs `ty` over a fixture that passes a context-aware middleware alongside `context_schema`; it fails against the previous bare annotation. Made by [Open SWE](https://openswe.vercel.app/agents/305e0718-361a-e13b-6940-8cb55cb29dee) Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com>
Marcelo5444
pushed a commit
to Marcelo5444/deepagents
that referenced
this pull request
Jul 30, 2026
building off of langchain-ai#1779 will assign co-author credit to @pawel-twardziak, thank you!! --------- Co-authored-by: Pawel Twardziak <pawel-twardziak@users.noreply.github.com>
Marcelo5444
pushed a commit
to Marcelo5444/deepagents
that referenced
this pull request
Jul 30, 2026
…ngchain-ai#4055) Closes langchain-ai#4051 --- `create_deep_agent` declared its `middleware` parameter as a bare `Sequence[AgentMiddleware]`. That pins `ContextT` to `None`, so type checkers reject context-aware middleware such as `AgentMiddleware[AgentState, Context]` even when a matching `context_schema` is passed. PR langchain-ai#2383 threaded `ContextT` through `context_schema` and the return type but missed `middleware`. This types it as `Sequence[AgentMiddleware[StateT_co, ContextT]]`, mirroring upstream `langchain.agents.create_agent`, so the inferred context type is preserved. `StateT_co` is imported from `langchain.agents.middleware.types`. A type-level regression test runs `ty` over a fixture that passes a context-aware middleware alongside `context_schema`; it fails against the previous bare annotation. Made by [Open SWE](https://openswe.vercel.app/agents/305e0718-361a-e13b-6940-8cb55cb29dee) Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
building off of #1779
will assign co-author credit to pawel-twardziak, thank you!!