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.
Agent Research Assistant
A command-line research tool that leverages Perplexity’s Agent API with thedeep-research preset to conduct thorough, multi-step web research on any topic. The tool produces structured reports with sections, cited sources, and confidence scores.
Features
- Multi-step web research powered by the
deep-researchpreset - Structured JSON output with sections, sources, and confidence scores using
response_formatwithjson_schema - Configurable model selection (defaults to
openai/gpt-5.2via the deep-research preset) - Clean CLI interface that accepts a topic and outputs a formatted report
- Source tracking with URLs and relevance annotations
- Exportable reports in JSON or plain text
Installation
API Key Setup
Set your Perplexity API key as an environment variable. The SDK reads it automatically:Usage
How It Works
- The CLI accepts a research topic as input.
- A structured JSON schema is defined for the report format using Pydantic (Python) or a TypeScript interface.
- The tool calls the Agent API with
preset="deep-research", which configures the model (openai/gpt-5.2), enablesweb_searchandfetch_urltools, and allows up to 10 reasoning steps. - The
response_formatparameter withjson_schemaenforces structured output matching the report schema. - The response is parsed and displayed as a formatted research report.
The
deep-research preset is optimized for complex, in-depth analysis. It uses openai/gpt-5.2 with up to 10K max tokens and 10 reasoning steps. You can override the model by passing --model to the CLI.Full Code
Example Output
Limitations
- Deep research requests consume more tokens and cost more than standard requests due to multi-step reasoning and tool usage.
- Structured output with JSON schema requires the model to adhere to the schema. Very complex schemas may reduce output quality.
- Confidence scores are model-generated estimates and should be treated as relative indicators, not absolute measures.
- The quality of research depends on the availability and quality of web sources for the given topic.