Learning resourcesReviewed · Perplexity

Perplexity Agent API: Custom Functions

Perplexity’s Custom Functions guide teaches developers to connect an AI agent to their own code, but their application must execute every requested function. Python and TypeScript examples explain function schemas, JSON arguments, result matching and conversation continuation.

Researched 15 Nov 2026

In short.

Perplexity’s Custom Functions guide is a tutorial for developers connecting an AI agent to application code, with the catch that the application must execute and return each requested function call. Its Python and TypeScript examples demonstrate an order lookup using a function schema, two API requests and a local lookup. The page explains how to preserve call identifiers and optional thought signatures. Both listings handle one round of function requests; repeated rounds and production failure handling require further implementation. Pricing, licensing and supported SDK versions are unknown from this page. Nothing was executed.

Researched and written by an AI model and checked by a second AI model. How it works

Covers the complete selected documentation page at [https://docs.perplexity.ai/docs/agent-api/tools/custom-functions.md], captured as selected-page.txt, including its examples, response arrays, notices and next-step links. The documentation-index notice is included, but the index, linked cookbook, tools overview and all other linked-page content are excluded. No dependencies were installed, code executed, API requests made or runtime behavior verified.

The overview

Identity

Custom Functions is a Perplexity Agent API documentation guide at [https://docs.perplexity.ai/docs/agent-api/tools/custom-functions.md]. It teaches application-managed function calling: the model requests a function, application code executes it, and the application returns the result.

The resource is a tutorial with sample code, rather than a standalone application or a downloadable agent definition.

Assessment

The guide is useful for understanding the boundary between a model requesting work and an application performing it. Matching Python and TypeScript examples, plus explicit response arrays, make the exchange concrete.

It is a starting point for integration, with limited production coverage. The sample uses an in-memory order dictionary and does not demonstrate a database connection, access controls or recovery from API and execution failures.

Users

The intended audience is developers who want an agent to retrieve information or invoke business logic through code they control. The page names database queries and internal APIs as possible implementations.

Beginners get a concrete order-status example, but need enough Python or TypeScript knowledge to install dependencies, handle JSON and call an API. Experienced developers get details about output-item replay, call identifiers and optional thought signatures.

Capabilities

The example declares get_order_status with a JSON Schema requiring a string order_id, disallowing additional properties and setting strict to true. The application then handles function_call items and returns JSON-encoded results.

The lookup returns order status, carrier and estimated delivery, or an error object for an unknown order. Database access and internal API calls are suggested extensions; their implementation is not demonstrated.

Using it

Requirements

The examples require a Perplexity API key, a Python or TypeScript execution environment, the corresponding SDK and application code implementing the declared function. The key is supplied through PERPLEXITY_API_KEY.

The sample model identifier is openai/gpt-5.6-sol. Supported model coverage, account access requirements, minimum runtime versions and compatible SDK versions are not specified.

Mechanism

The first responses.create request sends the question and function schema. A returned function_call contains the function name, JSON-encoded arguments and a call_id. The application parses the arguments, dispatches the function and appends a function_call_output carrying the same call_id and a string containing the result.

A second request supplies the continued conversation so the model can answer using that result. If another function is requested, the prose says to repeat the process. The Python example replays complete output objects; the TypeScript example reconstructs function-call items and preserves thought_signature when present.

Setup

For Python, the page specifies pip install perplexityai, exporting PERPLEXITY_API_KEY, saving custom_function.py and running python custom_function.py.

For TypeScript, it specifies npm install @perplexity-ai/perplexity_ai tsx, saving custom-function.ts and running npx tsx custom-function.ts. These are documented setup instructions; installation and execution were not performed.

Example

The user asks for the status of order ORD-10042. The illustrated function request supplies that order ID, and the local dictionary returns in_transit, DHL and an estimated delivery date of 2026-08-08.

The displayed final answer restates those fields in ordinary language. The terminal output and response arrays are documentation examples, not observed execution results. They establish the intended data flow without establishing reliability or performance.

Assessment & evidence

Limitations

Both code listings process function calls from the first response and then print the second response. They do not implement an outer loop for further function requests, although the explanatory text says to repeat when needed.

Unknown function names cause an exception, and missing orders produce an error object. The listings do not demonstrate malformed-argument recovery, retries, timeouts, caller authorization or parallel execution. Performance, reliability and real-service integration are not assessed.

Fit and tradeoffs

This approach fits work where an application already has code or services that an agent should request. Declaring a function describes the available operation; the application still controls its implementation and execution.

That separation implies additional orchestration work: dispatching requests, handling failures and continuing the conversation. Local execution also does not mean results stay local: the demonstrated function result is sent back to the Agent API. Data retention and privacy behavior are not established here.

Related approaches

The page points to built-in tools and MCP servers as related approaches through its tools overview. Their capabilities and tradeoffs are not explained on the selected page, so a comparative recommendation is not supported.

It also links a function-calling cookbook for multiple functions, parallel calls and production failures. That linked material is outside the available evidence.

Evidence

The evidence is the complete captured Custom Functions documentation page at [https://docs.perplexity.ai/docs/agent-api/tools/custom-functions.md], including both code listings, setup commands, response arrays, the thought_signature note and navigation links.

Its source revision is sha256:04223fe86dcb7844668b908d0647647db62923be91cc8bbc57033bb22ce1034c. The page supports an explanation of the documented protocol, but supplies no independent benchmark or demonstrated production outcome. Nothing was executed.

Access & freshness

Costs

The illustrated exchange makes two Agent API requests around one local function execution. Further function-request rounds would require additional API requests.

The page gives no prices, billing units, free allowance or worked cost estimate. API charges and any database or internal-service costs remain unknown.

Rights

The supplied page contains no explicit licence or redistribution terms for its prose or sample code. Permission to redistribute either is unknown from this evidence.

SDK licences, service terms and data-handling terms are also not provided on this page.

Freshness

The documentation snapshot was captured at 2026-11-15T05:34:59.718Z. The page provides no publication date, update date, pinned dependency versions or compatibility matrix.

The model identifier and sample delivery date are example values, not evidence of release timing or current availability. Current SDK and model compatibility remain unknown.

Practical next steps

Start with the sample dictionary to understand how function_call and function_call_output are paired. Before adapting it, confirm supported SDK and model versions, API access and current pricing.

For a real integration, add repeated-call handling, argument validation, authorization and failure recovery. Preserve call_id and any thought_signature when continuing the conversation, and decide which backend results may be returned to the API.

Evidence for this report

selected-page.txtselected · checked 2026-11-15