Tool use & agents - quickstart
Tool use enables developers to build agentic applications that connect to external tools, do reasoning, and perform actions.
The Chat endpoint comes with built-in tool use capabilities such as function calling, multi-step reasoning, and citation generation.
This quickstart guide shows you how to utilize tool use with the Chat endpoint.
Setup
First, install the Cohere Python SDK with the following command.
Next, import the library and create a client.
Cohere Platform
Private Deployment
Bedrock
SageMaker
Azure AI
Tool Definition
First, we need to set up the tools. A tool can be any function or service that can receive and send objects.
We also need to define the tool schemas in a format that can be passed to the Chat endpoint. The schema must contain the following fields: name
, description
, and parameters
.
Tool Calling
Next, pass the tool schema to the Chat endpoint together with the user message.
The LLM will then generate the tool calls (if any) and return the tool_plan
and tool_calls
objects.
Cohere Platform
Private Deployment
Bedrock
SageMaker
Azure AI
Tool Execution
Next, the tools called will be executed based on the arguments generated in the tool calling step earlier.