Langchain create_agent with tools parameter

I’d like to welcome to LangChain version 1.0.

I’m currently migrating my workflows to use create_agent, but I noticed that when a tool specified in tools is called, the agent makes an additional LLM call after the normal tool execution to generate an AIMessage.

I’m wondering if there’s a way to disable this behavior so that only the ToolMessage is returned.

In my planner stage, I aggregate and process tool information before execution, so if create_agent allowed disabling AI message generation, it would make LLM calls much more efficient.

Hi @mthekid

have you tried return_direct option?

from langchain.tools import tool

@tool(return_direct=True)
def lookup_user(user_id: str) -> str:
    """Return user details directly without a follow-up LLM turn."""
    return do_lookup(user_id)