Sydney Runkle
608d2343a1
lint
2025-10-16 18:40:38 -04:00
Sydney Runkle
ecc28d22d2
subclass
2025-10-16 18:39:51 -04:00
Sydney Runkle
0fd699e767
allow injecting direct subclasses
2025-10-16 18:37:19 -04:00
Sydney Runkle
ae8feeab3b
another rc
2025-10-16 17:55:18 -04:00
Eugene Yurtsev
90b68059f5
fix(langchain): revert conditional edge from tools to end ( #33520 ) ( #33539 )
...
This is causing an issue with one of the middlewares
2025-10-16 17:19:26 -04:00
Mason Daugherty
87ad5276e4
chore: add v1 migration link to MIGRATE.md ( #33537 )
2025-10-16 20:31:02 +00:00
Mason Daugherty
5489df75d7
release(huggingface): 1.0.0a1 ( #33536 )
langchain-huggingface==1.0.0a1
2025-10-16 16:21:38 -04:00
Sydney Runkle
c6b3f5b888
release(langchain): cut rc ( #33534 )
langchain-mistralai==1.0.0a1
langchain==1.0.0rc1
2025-10-16 19:55:38 +00:00
Mason Daugherty
15db024811
chore: more sweeping ( #33533 )
...
more fixes for refs
2025-10-16 15:44:56 -04:00
Jacob Lee
6d73003b17
feat(openai): Populate OpenAI service tier token details ( #32721 )
2025-10-16 15:14:57 -04:00
ccurme
13259a109a
release(standard-tests): 1.0.0rc1 ( #33531 )
langchain-tests==1.0.0rc1
2025-10-16 14:09:41 -04:00
ccurme
aa78be574a
release(core): 1.0.0rc2 ( #33530 )
langchain-core==1.0.0rc2
2025-10-16 13:00:39 -04:00
Mason Daugherty
d0dd1b30d1
docs(langchain_v1): remove absent arg descriptions ( #33529 )
2025-10-16 12:25:18 -04:00
Mason Daugherty
0338a15192
docs(chroma): remove an extra arg space ( #33526 )
2025-10-16 16:05:51 +00:00
Sydney Runkle
e10d99b728
fix(langchain): conditional edge from tools to end ( #33520 )
2025-10-16 11:56:45 -04:00
Mason Daugherty
c9018f81ec
docs(anthropic): update extended thinking docs and fix urls ( #33525 )
...
new urls
extended thinking isn't just 3.7 anymore
2025-10-16 11:18:47 -04:00
Eugene Yurtsev
31718492c7
fix(langchain_v1): relax tool node validation to allow claude text editing tools ( #33512 )
...
Relax tool node validation to allow claude text editing tools
2025-10-16 14:56:41 +00:00
Sydney Runkle
2209878f48
chore(langchain): update state schema doc ( #33524 )
2025-10-16 10:40:54 -04:00
Sydney Runkle
dd77dbe3ab
chore(langchain_v1): adding back state_schema to create_agent ( #33519 )
...
To make migration easier, things are more backwards compat
Very minimal footprint here
Will need to upgrade migration guide and other docs w/ this change
2025-10-16 10:12:34 -04:00
ccurme
eb19e12527
feat(core): support vertexai standard content ( #33521 )
2025-10-16 10:08:58 -04:00
Sydney Runkle
551e86a517
chore(langchain): use runtime not tool_runtime for injected tool arg ( #33522 )
...
fast follow to https://github.com/langchain-ai/langchain/pull/33500
2025-10-16 13:53:54 +00:00
Eugene Yurtsev
8734c05f64
feat(langchain_v1): tool retry middleware ( #33503 )
...
Adds `ToolRetryMiddleware` to automatically retry failed tool calls with
configurable exponential backoff, exception filtering, and error
handling.
## Example
```python
from langchain.agents import create_agent
from langchain.agents.middleware import ToolRetryMiddleware
from langchain_openai import ChatOpenAI
# Retry up to 3 times with exponential backoff
retry = ToolRetryMiddleware(
max_retries=3,
initial_delay=1.0,
backoff_factor=2.0,
)
agent = create_agent(
model=ChatOpenAI(model="gpt-4"),
tools=[search_tool, database_tool],
middleware=[retry],
)
# Tool failures are automatically retried
result = agent.invoke({"messages": [{"role": "user", "content": "Search for AI news"}]})
```
For advanced usage with specific exception handling:
```python
from requests.exceptions import Timeout, HTTPError
def should_retry(exc: Exception) -> bool:
# Only retry on 5xx errors or timeouts
if isinstance(exc, HTTPError):
return 500 <= exc.response.status_code < 600
return isinstance(exc, Timeout)
retry = ToolRetryMiddleware(
max_retries=4,
retry_on=should_retry,
tools=["search_database"], # Only apply to specific tools
)
```
2025-10-16 09:47:43 -04:00
Sydney Runkle
0c8cbfb7de
chore(langchain_v1): switch order of params in ToolRuntime ( #33518 )
...
To match `Runtime`
2025-10-16 12:09:05 +00:00
Sydney Runkle
89c3428d85
feat(langchain_v1): injected runtime ( #33500 )
...
Goal here is 2 fold
1. Improved devx for injecting args into tools
2. Support runtime injection for Python 3.10 async
One consequence of this PR is that `ToolNode` now expects `config`
available with `runtime`, which only happens in LangGraph execution
contexts. Hence the config patch for tests.
Are we ok reserving `tool_runtime`?
before, eek:
```py
from langchain.agents import create_agent
from langchain.tools import tool, InjectedState, InjectedStore
from langgraph.runtime import get_runtime
from typing_extensions import Annotated
from langgraph.store.base import BaseStore
@tool
def do_something(
arg: int,
state: Annotated[dict, InjectedState],
store: Annotated[BaseStore, InjectedStore],
) -> None:
"""does something."""
print(state)
print(store)
print(get_runtime().context)
...
```
after, woo!
```py
from langchain.agents import create_agent
from langchain.tools import tool, ToolRuntime
@tool
def do_something_better(
arg: int,
tool_runtime: ToolRuntime,
) -> None:
"""does something better."""
print(tool_runtime.state)
print(tool_runtime.store)
print(tool_runtime.context)
...
```
```python
@dataclass
class ToolRuntime(InjectedToolArg, Generic[StateT, ContextT]):
state: StateT
context: ContextT
config: RunnableConfig
tool_call_id: str
stream_writer: StreamWriter
context: ContextT
store: BaseStore | None
2025-10-16 07:41:09 -04:00
Mason Daugherty
707e96c541
style: more sweeping refs work ( #33513 )
2025-10-15 23:33:39 -04:00
Mason Daugherty
26e0a00c4c
style: more work for refs ( #33508 )
...
Largely:
- Remove explicit `"Default is x"` since new refs show default inferred
from sig
- Inline code (useful for eventual parsing)
- Fix code block rendering (indentations)
2025-10-15 18:46:55 -04:00
Eugene Yurtsev
d0f8f00e7e
release(anthropic): 1.0.0a5 ( #33507 )
...
Release anthropic
langchain-anthropic==1.0.0a5
2025-10-15 21:31:52 +00:00
Eugene Yurtsev
a39132787c
feat(anthropic): add async implementation to middleware ( #33506 )
...
Add async implementation to middleware
2025-10-15 17:05:39 -04:00
Sydney Runkle
296994ebf0
release(langchain_v1): 1.0.0a15 ( #33505 )
langchain==1.0.0a15
2025-10-15 20:48:18 +00:00
ccurme
b5b31eec88
feat(core): include original block type in server tool results for google-genai ( #33502 )
2025-10-15 16:26:54 -04:00
Sydney Runkle
8f6851c349
fix(langchain_v1): keep state to relevant middlewares for tool/model call limits ( #33493 )
...
The one risk point that I can see here is that model + tool call
counting now occurs in the `after_model` hook which introduces order
dependency (what if you have HITL execute before this hook and we jump
early to `model`, for example).
This is something users can work around at the moment and we can
document. We could also introduce a priority concept to middleware.
2025-10-15 14:24:59 -04:00
Nuno Campos
0788461abd
feat(openai): Add openai moderation middleware ( #33492 )
2025-10-15 13:59:49 -04:00
ccurme
3bfd1f6d8a
release(core): 1.0.0rc1 ( #33497 )
langchain-core==1.0.0rc1
2025-10-15 13:02:35 -04:00
Mason Daugherty
d83c3a12bf
chore(core): delete BaseMemory, move to langchain-classic ( #33373 )
2025-10-15 12:55:23 -04:00
Mason Daugherty
79200cf3c2
docs: update package READMEs ( #33488 )
2025-10-15 10:49:35 -04:00
ccurme
bcb6789888
fix(anthropic): set langgraph-prebuilt dep explicitly ( #33495 )
2025-10-15 14:44:37 +00:00
ccurme
89b7933ef1
feat(standard-tests): parametrize tool calling test ( #33496 )
2025-10-15 14:43:09 +00:00
ccurme
4da5a8081f
fix(core): propagate extras when aggregating tool calls in v1 content ( #33494 )
2025-10-15 10:38:16 -04:00
Mason Daugherty
53e9f00804
chore(core): delete items marked for removal in schemas.py ( #33375 )
2025-10-15 09:56:27 -04:00
Chenyang Li
6e25e185f6
fix(docs): Fix several typos and grammar ( #33487 )
...
Just typo changes
Co-authored-by: Mason Daugherty <mason@langchain.dev >
2025-10-14 20:04:14 -04:00
Mason Daugherty
68ceeb64f6
chore(core): delete function_calling.py utils marked for removal ( #33376 )
2025-10-14 16:13:19 -04:00
Mason Daugherty
edae976b81
chore(core): delete pydantic_v1/ ( #33374 )
2025-10-14 16:08:24 -04:00
ccurme
9f4366bc9d
feat(mistralai): support reasoning feature and v1 content ( #33485 )
...
Not yet supported: server-side tool calls
2025-10-14 15:19:44 -04:00
Eugene Yurtsev
99e0a60aab
chore(langchain_v1): remove invocation request ( #33482 )
...
Remove ToolNode primitives from langchain
2025-10-14 15:07:30 -04:00
Eugene Yurtsev
d38729fbac
feat(langchain_v1): add async implementations to wrap_model_call ( #33467 )
...
Add async implementations to wrap_model_call for prebuilt middleware
2025-10-14 17:39:38 +00:00
gsmini
ff0d21cfd5
fix(langchain_v1): can not import "wrap_tool_call" from agents.… ( #33472 )
...
fix can not import `wrap_tool_call` from ` langchain.agents.middleware
import `
```python
from langchain.agents import create_agent
from langchain.agents.middleware import wrap_tool_call # here !
from langchain_core.messages import ToolMessage
@wrap_tool_call
def handle_tool_errors(request, handler):
"""Handle tool execution errors with custom messages."""
try:
return handler(request)
except Exception as e:
# Return a custom error message to the model
return ToolMessage(
content=f"Tool error: Please check your input and try again. ({str(e)})",
tool_call_id=request.tool_call["id"]
)
agent = create_agent(
model="openai:gpt-4o",
tools=[search, calculate],
middleware=[handle_tool_errors]
)
```
> example code from:
https://docs.langchain.com/oss/python/langchain/agents#tool-error-handling
2025-10-14 13:39:25 -04:00
Eugene Yurtsev
9140a7cb86
feat(langchain_v1): add override to model request and tool call request ( #33465 )
...
Add override to model request and tool call request
2025-10-14 10:31:46 -04:00
ccurme
41fe18bc80
chore(groq): fix integration tests ( #33478 )
...
- add missing cassette
- update streaming metadata test for v1
2025-10-14 14:16:34 +00:00
Mason Daugherty
9105573cb3
docs: create_agent style and clarify system_prompt ( #33470 )
2025-10-14 09:56:54 -04:00
Sydney Runkle
fff87e95d1
fix(langchain): rename PlanningMiddleware to TodoListMiddleware ( #33476 )
2025-10-14 09:06:06 -04:00