Skip to main content

Equity Research Brief

A command-line tool that generates a structured equity research brief for any public ticker using Perplexity’s Agent API and the built-in finance_search tool. finance_search returns structured market data — quotes, financials, earnings transcripts, peer comparisons, analyst estimates — so the model can compose a report grounded in numbers, not just narrative. The tool is purpose-built for agentic investor workflows.

Features

  • One command produces a 6-section brief: snapshot, business overview, financial trajectory, latest earnings, peer context, risks, bottom line
  • Uses the Agent API’s finance_search tool for structured fundamentals, quotes, and earnings-call transcripts
  • Three preset configurations matching the official finance_search recommendations:
    • quote — live price/quote only, fastest and cheapest
    • single — single-company historical lookup with web context
    • research — full multi-step cross-company brief (default)
  • Prints citation-ready Perplexity finance source URLs alongside the brief
  • Reports finance_search invocation count and total request cost
  • --json flag emits the raw Agent API response for downstream pipelines

Prerequisites

  • Python 3.9+
  • A Perplexity API key with Agent API access. finance_search is currently in beta — see the Finance Search docs for availability.

Installation

API Key Setup

You can also pass the key via --api-key, or place it in a .pplx_api_key file in the working directory.

Quick Start

Generate a full research brief on NVIDIA:

Usage

Just a live quote (cheapest, ~1 tool call)

Single-company historical lookup with web context

Full multi-step research brief (default)

Emit raw Agent API JSON

Configuration Reference

ConfigModelToolsMax stepsBest for
quoteperplexity/sonarfinance_search1Live prices, quotes, fastest path
singleopenai/gpt-5.5web_search + finance_search + fetch_url5One-company historical fundamentals
researchanthropic/claude-opus-4-7web_search + finance_search + fetch_url10Multi-company comparisons, full brief
These configurations are taken directly from the finance_search recommended configurations.

Example Output (truncated)

Code Walkthrough

The script does three things: 1. Issue a single Agent API call with finance_search enabled.
The model decides which finance_search categories to fetch (quote, financials, transcript, etc.) based on the prompt. You don’t need to hand-pick fields. 2. Walk response.output to extract both the assistant text and the structured finance_results blocks.
3. Surface cost and finance source URLs alongside the prose. The Perplexity finance pages returned in result.sources are stable, citation-ready links — useful when the brief is consumed by humans or by a downstream RAG pipeline.

Prompting Guidance

finance_search works best when the prompt asks for a business outcome, not for specific data shapes. The system prompt instructs the model to:
  • be quantitative and attribute numbers to the right period (e.g. FY2025, Q3 FY26)
  • never invent numbers — if finance_search doesn’t return a field, say so explicitly
  • format the output in clean Markdown
This pattern is documented in the finance_search prompt guidance.

Pricing

finance_search is billed at $5 per 1,000 invocations, separate from model token usage. Each preset has different cost characteristics:
  • quote: typically 1 invocation, ~$0.007 per brief
  • single: 1–3 invocations + GPT-5.5 tokens
  • research: 3–6 invocations + Claude Opus tokens
See Perplexity Pricing for current rates.

Limitations

  • finance_search is currently in beta and may not be enabled on all API keys
  • Results depend on Perplexity’s finance data coverage; obscure or non-US tickers may return less structured data
  • This is not investment advice. The “Bottom line” section is explicitly framed as analytical opinion, not a recommendation

Resources