A traveler asks for a holiday plan that fits a destination, budget, and forecast. Answering may require several sources and more than one decision. An AI agent uses a large language model (LLM) to choose actions, call tools, inspect results, and decide what to do next within developer-set constraints. It can combine database records, API responses, and documents into a useful answer. section 1.1.3
The basic loop is:
- Observe the request and available context. Describe the available tools and their purposes to the LLM. section 1.1.3
- Decide which tool to use, execute the call, and pass its result back to the LLM. section 1.1.3
- Use the new result to choose another action or produce a final response. Intermediate results, errors, or new information may change the next step. section 1.1
The distinction is where decisions happen. An engine runs a largely predefined chain and stops after its request; a chatbot focuses on conversation across exchanges. An agent can select and combine tools at runtime and revisit its approach. A workflow may use an LLM to choose among predefined paths, but its overall path remains structured. That predictability can be preferable when the task does not need open-ended tool selection. section 1.1.1 section 5.1
Figure 5.1 Workflows and agents. Workflows use the LLM to choose the next step from a fixed set of options, such as routing a request to a SQL database or a REST API, and synthesizing the answer with the related results. Agents, however, dynamically select and combine tools to achieve their objectives.
The diagram contrasts a workflow’s fixed options with an agent’s dynamic selection and combination of tools. section 5.1
Travel information agent
Start with one retriever that searches chunked Wikivoyage content about Cornwall destinations. Add a weather tool so the agent can answer a request for beach towns with pleasant current conditions. A grounded test response names St Ives and Newquay and reports their weather; the tool calls can then be inspected rather than inferred from the polished answer alone. section 11.1 section 11.9.2
For an implementation, begin with the LLM–tool exchange so the tool-calling protocol is visible, then use LangGraph’s built-in components to reduce wiring. Run requests and debug the flow between model and tool. When a tool is remote, inspect the registered tools and a LangSmith trace to verify that the expected service was actually called. section 11.0 section 11.6 section 13.4.5
Flexibility is not a guarantee of a correct action. Dynamic tool choice trades some predictability for adaptability; graphs make branching and repeated work easier to trace. For critical actions in finance or healthcare, include human review and validation rather than relying on the agent alone. section 1.1.1 section 5.3 section 1.1.3
































