LLM Learning Hub

workspace/llm-course/home

Tool Execution

Tool execution is the runtime step where the host application runs the selected function with the LLM-provided arguments and captures the return value to feed back into the conversation.

What is Tool Execution?

Tool execution is the runtime step where the host application runs the selected function with the LLM-provided arguments and captures the return value to feed back into the conversation.

Tool execution is the runtime step where the host application runs the selected function with the LLM-provided arguments and captures the return value to feed back into the conversation.

Where is it used?

LangChain `AgentExecutor` and OpenAI Assistants run tools server-side; the result is appended as a `tool` role message so the LLM can produce a final natural-language answer.

How to build it

Dispatch on `tool_call.function.name`, run the matching Python function, append `{"role": "tool", "tool_call_id": ..., "content": str(result)}` to messages, and re-call the LLM for a final answer.