tools array; the model decides when to call each one based on your prompt. This page covers wiring tools in and reading their output. For the full settings of any single tool, follow the link to its reference page.
Two kinds of tools
| Kind | How it works |
|---|---|
| Built-in tools | Perplexity-hosted capabilities: web search, URL fetch, people and finance search, and a code sandbox. Enable each by type; Perplexity runs it and returns the results inline. |
| Function tools | Your own functions. You declare the schema; when the model calls one, the run pauses and hands you the arguments to execute, then continues once you return the result. |
Enable built-in tools
Add each tool to thetools array by its type. Most built-in tools work with just the type — some accept optional settings (documented on their reference pages).
| Tool | type | Use it to |
|---|---|---|
| Web Search | web_search | Search the live web, with domain/date/location filters |
| Fetch URL Content | fetch_url | Pull and extract content from specific URLs |
| People Search | people_search | Find professionals and people |
| Finance Search | finance_search | Retrieve structured financial and market data |
| Sandbox | sandbox | Run code in an isolated container — see Run code |
Add a function tool
A function tool lets the agent call code you control — your database or an internal API. You declare the function with aname, a description, and a JSON Schema for its parameters. The model fills in the arguments; you run the function. This is how the agent reaches data it can’t know on its own — here, an order’s current status in your internal system.
output array contains a function_call item with the name and the arguments the model filled in.
function_call the model emitted, and a function_call_output carrying your result under the same call_id:
call_id is the correlation key: the function_call the model emits and the function_call_output you return must carry the same value. Set strict: true on the function tool to enforce the parameter schema. You continue the run by replaying the prior items in the input array — pass the function_call and its function_call_output together so the model sees its own request and your result.Read tool results
Built-in tools attach their output to the responseoutput array next to the message item — for example search_results, finance_results, or sandbox_results items, depending on which tool ran. Iterate the array to surface citations, generated files, or computed values. Each tool’s reference page documents its exact result shape; see, for example, Web Search → Response shape.
Next steps
Run code
Give the agent a sandbox to compute exact answers and return files.
Shape the output
Stream output as it arrives and enforce structured JSON.