Skip to main content

Perplexity

Use Perplexity’s models for research and Q&A with built-in web search. Perplexity models (Sonar) automatically search the web and provide grounded, cited answers — no separate search tool needed. Agentium supports two modes for the Perplexity provider: The provider automatically selects native mode when the Perplexity SDK is installed, falling back to the OpenAI SDK otherwise.

Setup


Factory

string
required
Model ID (e.g., "sonar", "sonar-pro", "sonar-deep-research", "sonar-reasoning-pro").
PerplexityConfig
Optional configuration object.

PerplexityConfig


Supported Models


Basic Example

Perplexity shines for research — answers are automatically web-grounded:

Search Options (Native SDK)

Search options require the @perplexity-ai/perplexity_ai package. They are silently ignored in OpenAI-compat fallback mode.
Configure search behavior via the search field in PerplexityConfig:

PerplexitySearchOptions


Citations & Search Results

When using the native SDK, the raw API response includes citations, search results, images, and related questions. Access them via result.raw:

Academic Research Agent

Use searchMode: "academic" to search scholarly sources:

The sonar-reasoning-pro model combines chain-of-thought reasoning with web search:

Full Example


Environment Variables


Cross-References

  • DeepSeek — Reasoning models without web search
  • xAI — Grok with optional live search
  • Tools — Extend Perplexity with custom tools
  • OpenAI-Compatible — How the fallback mode works