How to use ToolRuntime in arg_schema for a tool

Hi all,

While declaring a tool, I’m using the args_schema field to annotate each argument of the tool properly. In the older verion of the langchain and langgraph, I was suppossed to use Annotated[state, InjectedState] syntax to pass the state inside the tool, similar for config as well. But after the introduction of Context and ToolRuntime, I’m using the tool runtime in my tool.

The issue is, I can’t pass the ToolRuntime in the pydantic model with or without annotated key, and thus it throws an error. With pydantic it is easier to provide the tool context and arguments details in a different manner.

Please let me know what I can do?

hi @neel

There already was a discussion on that matter… Have you tried to search the forum?
Could you share some code of the scenarios you have tried? Something might have changed in the latest versions so I could retest