Skip to content

feat(perplexity): add Agent operation backed by the Perplexity Agent API - #10141

Draft
andrewmadson-pplx wants to merge 1 commit into
simstudioai:stagingfrom
andrewmadson-pplx:pplx/agent-tool
Draft

andrewmadson-pplx wants to merge 1 commit into
simstudioai:stagingfrom
andrewmadson-pplx:pplx/agent-tool

Conversation

@andrewmadson-pplx

Copy link
Copy Markdown

Summary

Adds an Agent operation to the Perplexity block, backed by the Perplexity Agent API (POST https://api.perplexity.ai/v1/agent). It runs a Perplexity or third-party model (default anthropic/claude-opus-5-5, or for example openai/gpt-5.5) with Perplexity's built-in web_search and fetch_url tools, and returns the answer, the web sources it used, token usage and the run status. When Sim supplies the API key, the run bills at the cost the Agent API reports in usage.cost.total_cost, following the __costDollars pattern in the Exa tools. Chat and Search are unchanged.

I work at Perplexity, which operates this API.

Product update (if relevant)

Perplexity block users can pick Agent to get a web-grounded answer from a Perplexity or third-party model in one step, with sources they can pass to downstream blocks. It sits alongside the Exa Agent and Parallel Deep Research operations. Docs: integrations/perplexity.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Other: ___________

Testing

  • cd apps/sim && bun run test -- tools/perplexity blocks (with the CI env vars NEXT_PUBLIC_APP_URL, DATABASE_URL, ENCRYPTION_KEY): Test Files 213 passed (213), Tests 1443 passed (1443). The Perplexity tests cover request mapping (web search on by default, URL fetch, instructions, step and token limits), response mapping (message text, search results, usage, cost), the failed-run message, cost billing, block routing, and an Agent tool call that carries the operation in the call context.
  • bun run --cwd apps/sim type-check and bun run type-check:scripts:esm: exit 0, no diagnostics.
  • bun run lint:check: 27 of 27 tasks pass (one existing warning in a file this PR does not touch).
  • bun run check:tool-metadata, check:docs, check:integration-catalog, check:deployment-config, check:mapper-operation, check:canvas-sentences (9841/9841 operations) and check:explicit-any, plus apps/sim/scripts/check-block-registry.ts: all exit 0.
  • Live runs at POST /v1/agent through the tool's request config, transformResponse and getCost: anthropic/claude-opus-5-5 with web search returned completed with 30 sources, and openai/gpt-5.5 with web search off and URL fetch on returned completed with the fetched page title. Both reported a cost.

To try it: run bun run dev, add a Perplexity block, pick Agent, and ask a current-events question on the default model. content should be a current answer and sources should list URLs. Then switch the model to openai/gpt-5.5, turn Web Search off and Fetch URLs on (advanced), and ask for the title of a docs URL.

Reviewers: the Agent model uses its own agentModel sub-block, so Chat's model value does not carry into it. content, systemPrompt and max_tokens are shared between Chat and Agent.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

Screenshots/Videos

@vercel

vercel Bot commented Nov 18, 2026

Copy link
Copy Markdown

@andrewmadson-pplx is attempting to deploy a commit to the Sim Team on Vercel.

A member of the Team first needs to authorize it.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant