Get startedGet started for free

Integrating custom tools with agents

Now that you have your tools at-hand, it's time to set up your agentic workflow! You'll again be using a ReAct agent, which, recall, reasons on the steps it should take, and selects tools using this context and the tool descriptions. An llm has already been defined for you that uses OpenAI's gpt-4o-mini model

This exercise is part of the course

Developing LLM Applications with LangChain

View Course

Exercise instructions

  • Create a ReAct agent using your retrieve_customer_info tool and the llm provided.
  • Invoke the agent on the input provided and print the content from the final message in messages.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

@tool
def retrieve_customer_info(name: str) -> str:
    """Retrieve customer information based on their name."""
    customer_info = customers[customers['name'] == name]
    return customer_info.to_string()

# Create a ReAct agent
agent = ____

# Invoke the agent on the input
messages = ____({"messages": [("human", "Create a summary of our customer: Peak Performance Co.")]})
print(____)
Edit and Run Code