Goals
- Use tool calling to build your own AI agent with Friendli Model APIs
- Feel free to make your own custom tools!
Getting Started
- Go to Friendli Suite, and create an account.
- Grab a Personal API key to use Friendli Model APIs within an agent.
Step 1. Playground UI
Experience tool calling on the Playground!
- On your left sidebar, click the Model APIs option to access the playground page.
- You will see the models available as Model APIs. Select the one you want and click the endpoint.
- Click the Tools button, select the Search tool, and enter a query to see the response. 😀
Build your own creative tool. This section shows you how to make a custom tool that retrieves temperature information. (The completed code snippet is at the bottom.)
- Define a function for using as a custom tool
-
Send a function calling inference request
- Add your input as a
user role message.
- The information about the custom function (e.g.,
get_temperature) goes into the tools option. JSON schema describes the function’s parameters.
- The response includes the
arguments field, which contains values extracted from the user’s input that can be used as parameters of the custom function.
-
Generate the final response using the tool calling results
- Add the
tool_calls response as an assistant role message.
- Add the result obtained by calling the
get_temperature function as a tool message to the Chat API again.
Congratulations
You’ve now defined a custom tool and used it to generate an accurate and rich answer from an LLM.
Brainstorm creative ideas for your agent by reading these FriendliAI Blog articles:
Last modified on October 2, 2026