Repository navigation
feat(perplexity): add Agent operation backed by the Perplexity Agent API - #10141
Draft
andrewmadson-pplx wants to merge 1 commit into
Draft
andrewmadson-pplx wants to merge 1 commit into
andrewmadson-pplx wants to merge 1 commit into
Conversation
|
@andrewmadson-pplx is attempting to deploy a commit to the Sim Team on Vercel. A member of the Team first needs to authorize it. |
Closed
1 of 10 tasks
andrewmadson-pplx
force-pushed
the
pplx/agent-tool
branch
from
December 2, 2026 01:32
be71b07 to
d809527
Compare
andrewmadson-pplx
force-pushed
the
pplx/agent-tool
branch
from
December 2, 2026 21:42
d809527 to
da76811
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 (defaultanthropic/claude-opus-5-5, or for exampleopenai/gpt-5.5) with Perplexity's built-inweb_searchandfetch_urltools, 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 fromusage.cost.total_costin the Agent API response, the way the Exa tools take it fromcostDollars. 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
Testing
cd apps/sim && bun run test -- tools/perplexity blocks(with the CI env varsNEXT_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 generateleft no tracked changes. All 73 audits inbun run check:auditspassed. 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-typesandbun run check:desktop-bridgeeach exited 0.POST /v1/agentthrough the tool's request config,transformResponseandgetCost:anthropic/claude-opus-5-5with web search returnedcompletedwith 15 sources, andopenai/gpt-5.5with web search off and URL fetch on returnedcompletedwith the fetched page title. Both reported a cost:total_cost0.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. Checkcontentand the URLs insearch_results. Then switch the model toopenai/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
agentModelsub-block, so Chat's model value does not carry into it. Agent returns retrieved results insearch_results;dateandlast_updatedcan be null. Agent is markedwritebecause 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
Screenshots/Videos