Web-grounded chat completions, search, and embeddings via the Perplexity API.
Perplexity ships in the w6w first-party pack. It declares 5 actions, 2 health checks, and the host runs its code in a sandbox that never sees the credential.
io.w6w.perplexityPerplexity puts web-grounded AI into a workflow — a multi-provider chat/agent call that can optionally search the web as a tool, a standalone ranked web search that returns extracted page content, and text embeddings. The chat surface covers both the current Agent API and the older Sonar chat-completions endpoint it is replacing; Sonar keeps working for existing integrations through its documented retirement date, while new work should reach for the Agent API action instead.
The two chat actions differ in more than name: the Agent API accepts models from multiple providers, or a small set of stable presets that bundle a model and configuration, only searches the web when a search tool is explicitly attached and the model chooses to call it, and only returns inline citation markers when the prompt asks for them. Sonar, by contrast, searches by default and always returns citations. Both expose the same search filters — domain, recency, date range — just nested differently in the request.
A few response shapes are easy to misread: embeddings never come back as a plain numeric array, only as base64-encoded packed bytes that the caller decodes; and the model-listing action enumerates the Agent API’s own catalog, not Sonar’s fixed model names, since Sonar’s models aren’t a queryable list at all.
Three routes to the same 5 actions. The Workflow tab is generated from Perplexity's own manifest and carries its real ids, so it is copy-pasteable; the Code and CLI examples are the same call for any action on any app, so every app-specific value in them is a blank you fill in.
agent-response Generate a response using Perplexity's Agent API — the documented successor to Sonar chat completions (see `chat-completion`), with multi-provider models, optional web search, and an OpenAI-Responses-style `output[]` result. Prefer this action for new work.
chat-completion Generate a web-grounded chat completion from a Sonar model, with citations and search results. Sonar is deprecated by Perplexity in favor of the Agent API, effective 2026-09-27 — use the `agent-response` action for new work. See the README.
create-embeddings Generate embeddings for one or more input strings. The returned vectors are base64-encoded, not plain float arrays — see the README.
list-models List the third-party and Perplexity models available through the Agent API (POST /v1/agent). Does not include the Sonar chat-completion models.
A workflow step names the app and the action, and the editor fills in the
connection when you pick one. This is the Step shape from the
workflow spec, carrying Perplexity's real ids.
{
"manifestVersion": "2",
"name": "perplexity-example",
"steps": [
{
"id": "agent-response",
"uses": {
"app": "io.w6w.perplexity",
"action": "agent-response",
"connection": "conn_YOUR_CONNECTION_ID"
},
"with": {
"input": "<input>"
}
}
]
}agent-response chat-completion create-embeddings list-models web-search Every app-specific value here is a blank you have to fill in. An
app action is reached through the connection that authenticates it, so the
address is a connection id, not the app id — and connections belong to your account,
so a public page cannot know yours. Create one for Perplexity, then fill in
the three blanks: conn_YOUR_CONNECTION_ID, the action key, and the
parameters that action declares. The call itself is real — the shape is transcribed
from the studio's own snippet builder, which prints the same kind of blanks — but
nothing in it is specific to Perplexity. The Workflow tab is where this app's
real ids are.
npm install @w6w/sdkyarn add @w6w/sdkpnpm add @w6w/sdkdeno add npm:@w6w/sdkimport { W6wClient, isActionRun } from "@w6w/sdk";
// Reads W6W_BASE_URL and W6W_TOKEN from the environment when omitted.
const client = new W6wClient();
const envelope = await client.run({
urn: "conn_YOUR_CONNECTION_ID",
action: "agent-response",
payload: {
input: "<value>",
// instructions: "<value>",
// preset: "<value>",
// model: "<value>",
// models: "<value>",
// reasoningEffort: "<value>",
// maxOutputTokens: "<value>",
// maxSteps: "<value>",
// jsonSchema: "<value>",
// languagePreference: "<value>",
// previousResponseId: "<value>",
// store: "<value>",
// temperature: "<value>",
// topP: "<value>",
// enableWebSearch: "<value>",
// webSearchContextSize: "<value>",
// webSearchMaxResults: "<value>",
// webSearchMaxTokens: "<value>",
// webSearchMaxTokensPerPage: "<value>",
// searchDomainFilter: "<value>",
// searchRecencyFilter: "<value>",
// searchAfterDateFilter: "<value>",
// searchBeforeDateFilter: "<value>",
// lastUpdatedAfterFilter: "<value>",
// lastUpdatedBeforeFilter: "<value>",
},
});
if (isActionRun(envelope)) console.log(envelope.value); npm install -g @w6w/cli w6w run conn_YOUR_CONNECTION_ID --action agent-response --payload '{"input":"<value>"}' Give an AI agent Perplexity — without giving it Perplexity's credentials. One MCP endpoint exposes every app, function and workflow the caller is entitled to, as tools it can discover and run. Access is granted per team while we onboard.
One tool call{
"name": "w6w_invoke",
"arguments": {
"ref": "app:io.w6w.perplexity#agent-response",
"input": {
"input": "<input>"
}
}
}
Every tool names its target with a single ref. The
app: form above doesn't name a connection at all — the
host resolves which of the caller's Perplexity connections to sign
with, and refuses rather than guesses when the answer is ambiguous.
The token is attached host-side, at the moment of the call. It is never a tool argument, never in the model's context, and never in a transcript — so a prompt injection has nothing to exfiltrate.
Tools are derived per end user from what that person has actually connected and is entitled to — not one shared bot identity carrying the union of everyone's access.
Multi-step work runs on the workflow engine and returns a run handle the agent can poll — retries, branching and state survive the conversation that started them.
Perplexity's declared health checks are on the surface too, so an agent can tell "the vendor is down" from "your credential expired" before it burns a retry on either.
The MCP surface is part of the hosted platform. Perplexity itself is MIT, and the runtime that executes it is source-available (FSL).
Perplexity declares its own checks, so its health is a property of the app rather than something the host guesses at.
Instatus per-component status for status.perplexity.com. The verdict tracks the `API` component; `Website` and `Computer` are reported for attribution only. Unauthenticated and unsigned.
Not exposed: no response carries a rate-limit header, and the only usage-metering endpoints require a separate organization analytics key this app does not collect.