Skip to content

fix(agent): call Perplexity's Agent API, chat completions now returns 403 - #267

Closed
LeslieCBarry wants to merge 1 commit into
trycompai:mainfrom
LeslieCBarry:fix/perplexity-agent-api
Closed

LeslieCBarry wants to merge 1 commit into
trycompai:mainfrom
LeslieCBarry:fix/perplexity-agent-api

Conversation

@LeslieCBarry

@LeslieCBarry LeslieCBarry commented Nov 5, 2026 •

Copy link
Copy Markdown

We installed the CRM on Vercel this week and web research never worked. With a new key, every call from apps/agent/agent/lib/perplexity.ts comes back 403 with "Sonar is now the Agent API. Use /v1/responses instead of /v1/sonar." Perplexity ended Sonar chat completions on 27 September 2026, so any key made after that gets the 403. The capability still shows as on, so the agent keeps trying, and research_person, find_contact_socials and the LinkedIn slug search all come back empty.

This moves ask() to POST https://api.perplexity.ai/v1/agent. sonar maps to effort fast and sonar-pro to low, the system text goes in instructions, and a domain list becomes a filter on the web_search tool. The answer comes from the message item's output_text and the sources from every search_results item, parsed with zod. Callers don't change.

I checked it live with a new key. A question about a company came back with 20 sources, a sonar-pro question with 30, and the LinkedIn search found the right profile. apps/agent/test/perplexity.spec.ts covers the request and response mapping, and check-types, lint, lint:slop and test pass. bun run audit fails on main until #266 lands.

…nswers 403

Perplexity retired Sonar chat completions on 27 Sep 2026. A key created
after that gets 403 "Sonar is now the Agent API" from
/chat/completions, so research_person, find_contact_socials and the
LinkedIn slug search all fail. ask() now posts to /v1/agent: sonar maps
to effort fast, sonar-pro to effort low, the system text to
instructions, and a domain list to a web_search tool filter. The answer
is read from the message item's output_text and the sources from every
search_results item, parsed with zod.
@vercel

vercel Bot commented Nov 5, 2026

Copy link
Copy Markdown

@LeslieCBarry is attempting to deploy a commit to the Comp AI - PoC Team on Vercel.

A member of the Team first needs to authorize it.

@vercel
vercel Bot temporarily deployed to Preview – crm-app November 5, 2026 08:56 Inactive
@vercel

vercel Bot commented Nov 5, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
crm-app Skipped Skipped Nov 5, 2026 8:56am UTC

Request Review

@LeslieCBarry LeslieCBarry closed this by deleting the head repository Nov 6, 2026

This branch was previously deployed

1 inactive deployment
Preview – crm-app — 9f380c25 Deployed Nov 5, 2026 by vercel[bot]
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