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

@andrewmadson-pplx andrewmadson-pplx commented Nov 18, 2026 •

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 search results it retrieved, token usage and the run status. When Sim supplies the API key, the tool takes the run cost from usage.cost.total_cost in the Agent API response, the way the Exa tools take it from costDollars. Chat and Search requests 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. 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 225 passed (225), Tests 1509 passed (1509). 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 calculation, block routing, and an Agent tool call that carries the operation in the call context.
  • bun run lint:check: 31 of 31 tasks pass (the existing warnings are all in files this PR does not touch).
  • bun run generate left no tracked changes. All 73 audits in bun run check:audits passed. The migration, frozen SDK name and block registry checks passed against staging.
  • bun run --cwd apps/sim type-check, bun run type-check:scripts:esm, bun run check:test-types and bun run check:desktop-bridge each exited 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 15 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: total_cost 0.0454 and 0.00818.

To try it: run bun run dev, add a Perplexity block, pick Agent, and ask a current-events question on the default model. Check content and the URLs in search_results. 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. Agent returns retrieved results in search_results; date and last_updated can be null. Agent is marked write because the API stores a retrievable run by default. In a dry run, Sim returns a placeholder unless the block is explicitly allowed to run.

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