revert: remove backend from create_agent and AgentRuntime

backend belongs only on deepagents.AgentRuntime, injected exclusively
via BackendMiddleware._build_runtime — not on the langchain layer
This commit is contained in:
Sydney Runkle
2026-06-05 16:30:43 -04:00
parent 35be8df935
commit 782421840e
2 changed files with 0 additions and 10 deletions

View File

@@ -520,7 +520,6 @@ def create_agent( # noqa: PLR0915
debug: bool = False,
name: str | None = None,
cache: BaseCache | None = None,
backend: object | None = None,
) -> CompiledStateGraph[
AgentState[ResponseT], ContextT, _InputAgentState, _OutputAgentState[ResponseT]
]:
@@ -730,7 +729,6 @@ def create_agent( # noqa: PLR0915
runtime,
model_name=_agent_model_name,
tools=default_tools,
backend=backend,
)
)
@@ -1077,7 +1075,6 @@ def create_agent( # noqa: PLR0915
tools=default_tools,
tool_choice=None,
response_format=initial_response_format,
backend=backend,
)
)
request = ModelRequest.from_runtime(agent_runtime, messages=state["messages"], state=state)

View File

@@ -100,11 +100,6 @@ class AgentRuntime(Runtime[ContextT]):
model_settings: dict[str, Any] = field(default_factory=dict)
"""Additional model-specific settings."""
backend: object | None = field(default=None)
"""Opaque backend object injected by subpackages (e.g. deepagents).
Typed as ``object`` at this layer; subpackages narrow the type via
``AgentMiddleware._build_runtime``."""
@classmethod
def from_runtime(
cls,
@@ -118,7 +113,6 @@ class AgentRuntime(Runtime[ContextT]):
tools: list[BaseTool | dict] | None = None,
response_format: ResponseFormat | None = None,
model_settings: dict[str, Any] | None = None,
backend: object | None = None,
) -> AgentRuntime[ContextT]:
"""Construct an AgentRuntime from a base LangGraph Runtime."""
inherited = {f.name: getattr(runtime, f.name) for f in dc_fields(Runtime)}
@@ -132,7 +126,6 @@ class AgentRuntime(Runtime[ContextT]):
tools=tools or [],
response_format=response_format,
model_settings=model_settings or {},
backend=backend,
)