Documentation Index
Fetch the complete documentation index at: https://docs.perplexity.ai/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Mastra is an open-source TypeScript framework for building AI agents and workflows. It ships first-class Perplexity integrations through its model router and tool system, so you can wire Perplexity into a MastraAgent with a single string identifier or expose the Search API as a Mastra-compatible tool.
Mastra provides a unified
Agent interface, a model router, and a tools/MCP system for orchestrating LLM workflows. Learn more at mastra.ai.- Perplexity model provider — Use Perplexity’s web-grounded models in a Mastra
Agent. - Perplexity Agent provider — Use the Agent API (OpenAI-compatible
/chat/completions) through Mastra. - Perplexity Search tool — Expose the Search API as a Mastra tool for ranked web results.
API Key Setup
All three integrations read your Perplexity API key from the environment:PPLX_API_KEY as a fallback.
Get API Key
Generate your API key from the Perplexity dashboard.
Perplexity Model Provider
Use Perplexity’s web-grounded models inside a MastraAgent through the model router.
agent.generate(...) and agent.stream(...). For the full list of Perplexity models available through the router, see the Mastra Perplexity provider docs.
Perplexity Agent Provider
The Agent provider routes through Perplexity’s OpenAI-compatible/chat/completions endpoint, giving you access to third-party models served by the Agent API.
Perplexity Search Tool
The@mastra/perplexity package wraps the Search API as a Mastra-compatible tool. Use this when you want raw ranked web results — for chat completions or agentic workflows, prefer the model or Agent provider above.
perplexity-search and supported input parameters include query, maxResults, searchDomainFilter, searchRecencyFilter, searchAfterDateFilter, and searchBeforeDateFilter. Each result includes title, url, snippet, and an optional date.
To register multiple Perplexity tools at once, use createPerplexityTools(config?). See the Mastra Perplexity tool reference for the full schema.
Links & Resources
Perplexity Model Provider
Use Perplexity models in a Mastra
Agent.Perplexity Agent Provider
Use the Perplexity Agent API through Mastra.
Perplexity Search Tool
Wrap the Perplexity Search API as a Mastra tool.
Mastra Docs
Learn more about agents, tools, and workflows in Mastra.
Support
Need help with the integration?- Browse the Mastra documentation
- Review our FAQ