Building AI Agents with LangChain and LangGraph: Part 2 › Recap: Building Blocks from Part 1

Michael BrenndoerferAugust 2, 20251 min read
Building AI Agents with LangChain and LangGraph: Part 2 › Recap: Building Blocks from Part 1One section · Sections in this article3 / 9 ↓
Reading tools Definitions & inline links

Toggle tooltip visibility. Hover over underlined terms for instant definitions.

Article links

Make inline references clickable

Let's quickly set up the foundational components we established in Part 1 - our language model and reply tool. These will serve as the building blocks for our more sophisticated workflows.

In[2]:
Code
llm = init_chat_model("google_vertexai:gemini-2.0-flash", temperature=0)


@tool
def draft_customer_reply(customer_name: str, request_category: str, reply: str) -> str:
    """Draft a reply to a customer."""
    return f"I am drafting a reply to {customer_name} in the category {request_category}.\n Content: {reply}"


model_with_tools = llm.bind_tools(
    [draft_customer_reply], tool_choice="any", parallel_tool_calls=False
)