Perplexity AI

Ask questions and search the web with AI-powered answers via Perplexity.

AI and MLAPI key1 actionAll integrations

On this page
  1. Connect
  2. Call it from a workflow
  3. Actions (1)
  4. ask-ai
  5. Details

Connect

Auth type: API key (secret_text). Pass the provider's API key or token as the connection's credential. It is sealed at rest and only opened on the server when an action runs.

  • From your agent: integrations {action: "connect", piece, credentials, env} stores the credentials for dev, prod or all. Answers name the fields, never the values.
  • Or set the integration's project secrets with the secrets tool (SLACK_BOT_TOKEN, DISCORD_WEBHOOK_URL, TELEGRAM_BOT_TOKEN, TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN …): a call uses the connection, else those secrets. integrations {action: "catalog", piece} lists which ones work.
  • Try one action now with integrations {action: "call", piece, piece_action, input}. It really sends.

Call it from a workflow

step.ctx.integrations.invoke("perplexity_ai", action, input) resolves with the provider's answer and rejects when Perplexity AI isn't connected or refuses. Wrap it in step.run so a retry sends once. See step.ctx. Its actions run through the integration runner, which the server's operator turns on: integrations {action: "catalog", piece: "perplexity_ai"} says whether yours can call it.

Workflow
// workflows/notify.ts: call Perplexity AI when a booking is confirmed
import { on } from "@appbricx/workflows";

export const tellPerplexityAi = on.transition("booking", "status", "confirmed", async (_event, step) => {
  // Recorded once: a retry doesn't send it twice. Rejects when Perplexity AI isn't connected.
  const output = await step.run("Perplexity AI", () =>
    step.ctx.integrations.invoke("perplexity_ai", "ask-ai", {
      "model": "sonar-reasoning-pro",
      "prompt": "<question>"
    }),
  );
  step.ctx.log("Perplexity AI answered", output);
});
Try it from your agent
{
  "name": "integrations",
  "arguments": {
    "project_id": "<project-id>",
    "action": "call",
    "piece": "perplexity_ai",
    "piece_action": "ask-ai",
    "input": {
      "model": "sonar-reasoning-pro",
      "prompt": "<question>"
    },
    "env": "dev"
  }
}
From another backend (connector proxy)
curl -X POST "$APP_ORIGIN/__appbricx/connector-proxy/perplexity_ai/ask-ai" \
  -H "Authorization: Bearer $APP_KEY" \
  -H "content-type: application/json" \
  -d '{"props":{"model":"sonar-reasoning-pro","prompt":"<question>"}}'

Actions

ask-ai

Ask AI. Enables users to generate prompt completion based on a specified model.

InputTypeDescription
modelrequiredone of "sonar-reasoning-pro" | "sonar-reasoning" | "sonar-pro" | "sonar"Model
promptrequiredlong textQuestion
temperatureoptionalnumberThe amount of randomness in the response.Higher values are more random, and lower values are more deterministic.
max_tokensoptionalnumberPlease refer [guide](https://docs.perplexity.ai/guides/model-cards) for each model token limit.
top_poptionalnumberThe nucleus sampling threshold, valued between 0 and 1 inclusive. For each subsequent token, the model considers the results of the tokens with top_p probability mass.
presence_penaltyoptionalnumberNumber between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the mode's likelihood to talk about new topics.
frequency_penaltyoptionalnumberA multiplicative penalty greater than 0. Values greater than 1.0 penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line ve…
rolesoptionalJSONArray of roles to specify more accurate response.After the (optional) system message, user and assistant roles should alternate with user then assistant, ending in user.

Details

Id
perplexity_ai
Category
AI and ML
Tags
ai, perplexity, search, answers, research
Package
@activepieces/piece-perplexity-ai@0.3.3
Runs
Through the integration runner