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
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 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 inusage.cost.total_cost, following the__costDollarspattern 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
Testing
cd apps/sim && bun run test -- tools/perplexity blocks(with the CI env varsNEXT_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-checkandbun 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) andcheck:explicit-any, plusapps/sim/scripts/check-block-registry.ts: all exit 0.POST /v1/agentthrough the tool's request config,transformResponseandgetCost:anthropic/claude-opus-5-5with web search returnedcompletedwith 30 sources, andopenai/gpt-5.5with web search off and URL fetch on returnedcompletedwith 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.contentshould be a current answer andsourcesshould list URLs. 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.content,systemPromptandmax_tokensare shared between Chat and Agent.Checklist
Screenshots/Videos