Skip to content
Scalekit Docs
Talk to an Engineer Dashboard

Connect AI agents to Perplexity

Scalekit connector
Open markdown

The Perplexity connector lets your AI agent act in each user's Perplexity account. Each user connects their own Perplexity access token once, and Scalekit sends it with every call, so your agent never handles credentials. It comes with 17 tools.

Tools
17
What they doRead · write · destructive
13 · 4 · 013 read4 write0 destructive
Users sign in with

Setup

  1. Install the SDK

    Terminal window
    npm install @scalekit-sdk/node dotenv
  2. Set your credentials

    Add your Scalekit credentials to your .env file. Find values in app.scalekit.com > Developers > API Credentials.

    .env
    SCALEKIT_ENVIRONMENT_URL=<your-environment-url>
    SCALEKIT_CLIENT_ID=<your-client-id>
    SCALEKIT_CLIENT_SECRET=<your-client-secret>
  3. Create the Perplexity connection

    In AgentKit > Connections, create a Perplexity connection. The name you give it is the connection_name your code passes. See Configure connections.

  4. Authorize a user and make your first call

    quickstart.mts
    import { ScalekitClient } from '@scalekit-sdk/node'
    import 'dotenv/config'
    import { createInterface } from 'node:readline/promises'
    const scalekit = new ScalekitClient(
    process.env.SCALEKIT_ENVIRONMENT_URL,
    process.env.SCALEKIT_CLIENT_ID,
    process.env.SCALEKIT_CLIENT_SECRET,
    )
    const actions = scalekit.actions
    const connector = 'perplexity'
    const identifier = 'user_123'
    // Generate an authorization link for the user
    const { link } = await actions.getAuthorizationLink({ connectionName: connector, identifier })
    console.log('Authorize Perplexity:', link)
    const rl = createInterface({ input: process.stdin, output: process.stdout })
    await rl.question('Press Enter after authorizing...')
    rl.close()
    // Make your first call
    const result = await actions.executeTool({
    connector,
    identifier,
    toolName: 'perplexity_list_async_chat_completions',
    toolInput: {},
    })
    console.log(result)
    Terminal window
    npx tsx quickstart.mts

    Each user opens the link once and enters their Perplexity credentials there. See Authorize a user for the full flow and statuses.

Tools

Pass the exact name to execute_tool
Try in PlaygroundRequest a tool
  • perplexity_answer_decisionsEvaluate named yes/no, multiple-choice, and scoring questions against a piece of content.Read-only

    Answer Decisions

    Evaluate named yes/no, multiple-choice, and scoring questions against a piece of content. Returns an answers object keyed by question name (probability for noul, chosen option for choice, level for score), plus the model and token usage. Use this for classification, moderation, routing, and rubric scoring over text; use perplexity_chat_completion for open-ended answers.

    Inputs

    modelstringrequired
    Decision model: pplx-decider-v1.2 (larger) or pplx-decider-flash-v1.2 (faster, cheaper). Aliases pplx-decider-latest and pplx-decider-flash-latest also work.
    questionsobjectrequired
    Questions as a JSON object mapping a name you choose to a question. Each question has a type of noul (yes/no, with instructions), choice (with criteria mapping option names to descriptions), or score (with criteria listing level descriptions). Example: {"is_bug":{"type":"noul","instructions":"Is this a bug report?"},"area":{"type":"choice","criteria":{"billing":null,"settings":null}}}
    statestringrequired
    The content every question refers to: plain text, or a JSON object or array serialized as a string. Example: Customer wrote: the app crashes every time I open settings.
  • perplexity_create_contextualized_embeddingsGenerate document-aware embeddings for chunks, where each chunk is encoded with the context of its sibling chunks.Read-only

    Create Contextualized Embeddings

    Generate document-aware embeddings for chunks, where each chunk is encoded with the context of its sibling chunks. Returns a data array with one entry per document holding its chunk embeddings (base64-encoded), plus model and token usage. Use this for chunked documents in retrieval pipelines; use perplexity_create_embeddings for independent texts.

    Inputs

    inputarrayrequired
    Documents as a JSON array of arrays: each inner array holds the ordered chunk strings of one document (max 512 documents, 16,000 chunks total). Example: [["intro chunk","body chunk"],["other doc chunk"]]
    modelstringrequired
    Contextualized embedding model: pplx-embed-context-v1-0.6b (up to 1024 dimensions) or pplx-embed-context-v1-4b (up to 2560 dimensions).one of pplx-embed-context-v1-0.6bpplx-embed-context-v1-4b
    dimensionsinteger
    Output dimensions (128-1024 for the 0.6b model, 128-2560 for the 4b model). Defaults to the model full size. Example: 512
    encoding_formatstring
    Encoding of returned vectors: base64_int8 (default) or base64_binary (1 bit per dimension).one of base64_int8base64_binary
  • perplexity_create_embeddingsGenerate text embeddings for one or many independent texts.Read-only

    Create Embeddings

    Generate text embeddings for one or many independent texts. Returns a data array with one embedding per input (base64-encoded), plus model and token usage. Use this for independent texts such as queries or sentences. Use perplexity_create_contextualized_embeddings for chunks that belong to the same document.

    Inputs

    inputarrayrequired
    Texts to embed, as a JSON array of 1-512 non-empty strings. Total must stay under 120,000 tokens. Example: ["first passage","second passage"]
    modelstringrequired
    Embedding model: pplx-embed-v1-0.6b (up to 1024 dimensions) or pplx-embed-v1-4b (up to 2560 dimensions).one of pplx-embed-v1-0.6bpplx-embed-v1-4b
    dimensionsinteger
    Output dimensions (128-1024 for the 0.6b model, 128-2560 for the 4b model). Defaults to the model full size. Example: 512
    encoding_formatstring
    Encoding of returned vectors: base64_int8 (default) or base64_binary (1 bit per dimension).one of base64_int8base64_binary
  • perplexity_get_agent_responseFetch one Agent API response by id, including its current status.Read-only

    Get Agent Response

    Fetch one Agent API response by id, including its current status. Returns id, status, model, output items, error details if any, and token usage. Use this to poll a background run or re-read a stored response. Requires the response id returned by perplexity_create_agent_response.

    Inputs

    idstringrequired
    Id of the agent response, as returned by perplexity_create_agent_response (starts with resp_). Example: resp_abc123
  • perplexity_get_async_chat_completionFetch the status and result of one async chat completion job by id.Read-only

    Get Async Chat Completion

    Fetch the status and result of one async chat completion job by id. Returns id, model, status, created/started/completed/failed timestamps, error_message, and the full response once finished. Use this to poll a job created with perplexity_create_async_chat_completion; use perplexity_list_async_chat_completions to find job ids. Requires the job id returned when the job was created.

    Inputs

    api_requeststringrequired
    Id of the async chat completion job, as returned by perplexity_create_async_chat_completion or perplexity_list_async_chat_completions. Example: 7d1a2b3c-4e5f-6789-abcd-0123456789ab
  • perplexity_get_skillGet one custom skill by id, optionally at a specific revision.Read-only

    Get Skill

    Get one custom skill by id, optionally at a specific revision. Returns skill_id, name, description, revision, latest_revision, and created/updated timestamps. Use this for one skill's metadata; use perplexity_list_skill_revisions for its history. Requires a skill id from perplexity_list_skills.

    Inputs

    skill_idstringrequired
    Id of the skill, as returned by perplexity_list_skills. Example: skill_abc123
    revisionstring
    Revision id to fetch; defaults to the latest revision. Example: rev_001
  • perplexity_get_skill_download_urlGet a download URL for a custom skill's package, optionally for a specific revision.Read-only

    Get Skill Download URL

    Get a download URL for a custom skill's package, optionally for a specific revision. Returns revision, name, and a download_url to fetch the package from. Use this to retrieve a skill's files; use perplexity_get_skill for metadata only. Requires a skill id from perplexity_list_skills.

    Inputs

    skill_idstringrequired
    Id of the skill, as returned by perplexity_list_skills. Example: skill_abc123
    revisionstring
    Revision id to download; defaults to the latest revision. Example: rev_001
  • perplexity_list_agent_response_filesList the files an Agent API response generated, such as sandbox outputs.Read-only

    List Agent Response Files

    List the files an Agent API response generated, such as sandbox outputs. Returns a data array of file records, each with a file id and metadata. Use this to see what a finished run produced. Requires the response id from perplexity_create_agent_response.

    Inputs

    idstringrequired
    Id of the agent response, as returned by perplexity_create_agent_response (starts with resp_). Example: resp_abc123