Agent Types
What are Agents? left off with model, tools, and the loop. This page is the naming mess around that loop — then a short script you can run.
create_agent
In current LangChain you wire agents with create_agent. Pass a model id and a list of @tool functions. Call invoke with messages — the library handles the back-and-forth.
You are not choosing "agent type" in a dropdown. The names below describe how the model asks for a tool, not a different Python class.
Names you will see
Tutorials disagree on wording. These three cover almost everything:
Tool-calling — the model returns a tool_calls block (OpenAI-style). This is what create_agent expects with gpt-4o-mini.
ReAct — the model prints Thought, Action, and Observation as plain text. Common in older blog posts; we cover it again in ReAct Framework.
Direct reply — no tool on that turn. The model answers straight away when it already knows the fact.
Tool-calling
tool_calls: [
{ name: "multiply",
args: { a: 24, b: 17 } }
]
multiply(24, 17) → 408
then the model answersReAct
Thought: need to multiply Action: multiply Action Input: 24, 17 Observation: 408 Final Answer: 408
Tools are optional per turn
Handing the agent a multiply function does not mean every question uses it. "What does <title> do?" is basic HTML — the model can skip the tool. For "24 × 17" you want the function so you are not trusting mental math.
Demo asks both:
Wire one tool
Tool Calling goes into schemas and errors. For now, the shape is: decorate a function, pass it to create_agent, invoke.
from langchain.agents import create_agent
from langchain.tools import tool
@tool
def multiply(a: int, b: int) -> int:
"""Multiply two integers."""
return a * b
agent = create_agent(model="openai:gpt-4o-mini", tools=[multiply])
result = agent.invoke({
"messages": [{"role": "user", "content": "What is 24 times 17?"}],
})
print(result["messages"][-1].content)Run the demo
Venv from Project Setup. Download, then:
agent_types_demo.py
Two questions, one agent
OPENAI_API_KEY in .env, same as LangChain Basics.python agent_types_demo.py
multiply first.More options on create_agent in the docs.