[GH-ISSUE #1178] [langchain]: Missing documentation for accessing tool_call_id and config in Tools page #160

Open
opened 2026-02-17 17:19:18 -05:00 by yindo · 0 comments
Owner

Originally created by @donMichaelL on GitHub (Oct 29, 2025).
Original GitHub issue: https://github.com/langchain-ai/docs/issues/1178

Originally assigned to: @mdrxy on GitHub.

Type of issue

request for content

Language

Python

Description

In the LangChain Tools documentation, the introductory section lists several runtime information that can be accessed from within the tool function. While most of these attributesare well documented, two of them are listed without any explanation or example:

  • Config — RunnableConfig for the execution
  • Tool Call ID — ID of the current tool call

It would be very useful to include examples that show how to access these values in practice. For instance:

@tool
def get_account_info(runtime: ToolRuntime[UserContext]) -> str:
    """Get the current user's account information."""
    user_id = runtime.context.user_id

    print(runtime.config["configurable"]["thread_id"]) # Config
    print(runtime.tool_call_id) # Tool Call ID

    if user_id in USER_DATABASE:
        user = USER_DATABASE[user_id]
        return f"Account holder: {user['name']}\nType: {user['account_type']}\nBalance: ${user['balance']}"
    return "User not found"

model = ChatOpenAI(model="gpt-4o")
agent = create_agent(
    model,
    tools=[get_account_info],
    context_schema=UserContext,
    system_prompt="You are a financial assistant."
)

config = {"configurable": {"thread_id": "1"}}

result = agent.invoke(
    {"messages": [{"role": "user", "content": "What's my current balance?"}]},
    config=config,
    context=UserContext(user_id="user123")
)
Originally created by @donMichaelL on GitHub (Oct 29, 2025). Original GitHub issue: https://github.com/langchain-ai/docs/issues/1178 Originally assigned to: @mdrxy on GitHub. ### Type of issue request for content ### Language Python ### Description In the [LangChain Tools documentation](https://docs.langchain.com/oss/python/langchain/tools#accessing-context), the introductory section lists several runtime information that can be accessed from within the tool function. While most of these attributesare well documented, two of them are listed without any explanation or example: - Config — RunnableConfig for the execution - Tool Call ID — ID of the current tool call It would be very useful to include examples that show how to access these values in practice. For instance: ```python @tool def get_account_info(runtime: ToolRuntime[UserContext]) -> str: """Get the current user's account information.""" user_id = runtime.context.user_id print(runtime.config["configurable"]["thread_id"]) # Config print(runtime.tool_call_id) # Tool Call ID if user_id in USER_DATABASE: user = USER_DATABASE[user_id] return f"Account holder: {user['name']}\nType: {user['account_type']}\nBalance: ${user['balance']}" return "User not found" model = ChatOpenAI(model="gpt-4o") agent = create_agent( model, tools=[get_account_info], context_schema=UserContext, system_prompt="You are a financial assistant." ) config = {"configurable": {"thread_id": "1"}} result = agent.invoke( {"messages": [{"role": "user", "content": "What's my current balance?"}]}, config=config, context=UserContext(user_id="user123") ) ```
yindo added the langchainexternal labels 2026-02-17 17:19:18 -05:00
yindo changed title from [langchain]: Missing documentation for accessing tool_call_id and config in Tools page to [GH-ISSUE #1178] [langchain]: Missing documentation for accessing tool_call_id and config in Tools page 2026-06-05 17:25:24 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/docs#160