Use Runtime[MyContext] with @tool

Hi! I’m migrating my code from RunnableConfig.configurable to Runtime[MyContext]. This is how I was using Tools before:

@tool(args_schema=ToolSchema)
async def call_my_tool(
    tool_call_id: Annotated[str, InjectedToolCallId],
    config: RunnableConfig,
    name: str,
):
    ...

I used it like this because my RunnableConfig contained all my data, but now I’m migrating it to Runtime in 0.6.x. How am I supposed to access my data using Runtime[MyContext]? I tried to find it in docs but I couldn’t find it.


For now we support the get_runtime method for tools, but we’re planning support soon for Runtime injection into tools like for other nodes.

1 Like

Thats great! I’ll try it out as soon as I can!