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
Section titled “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_searchtool for structured fundamentals, quotes, and earnings-call transcripts - Three preset configurations matching the official
finance_searchrecommendations:quote— live price/quote only, fastest and cheapestsingle— single-company historical lookup with web contextresearch— full multi-step cross-company brief (default)
- Prints citation-ready Perplexity finance source URLs alongside the brief
- Reports
finance_searchinvocation count and total request cost --jsonflag emits the raw Agent API response for downstream pipelines
Prerequisites
Section titled “Prerequisites”- Python 3.9+
- A Perplexity API key with Agent API access.
finance_searchis currently in beta — see the Finance Search docs for availability.
Installation
Section titled “Installation”cd docs/examples/equity-research-brief
pip install -r requirements.txt
chmod +x equity_research_brief.pyAPI Key Setup
Section titled “API Key Setup”export PERPLEXITY_API_KEY="your-api-key-here"You can also pass the key via --api-key, or place it in a .pplx_api_key file in the working directory.
Quick Start
Section titled “Quick Start”Generate a full research brief on NVIDIA:
./equity_research_brief.py NVDA./equity_research_brief.py TICKER [--config {quote,single,research}] [--json] [--api-key KEY]Just a live quote (cheapest, ~1 tool call)
Section titled “Just a live quote (cheapest, ~1 tool call)”./equity_research_brief.py AAPL --config quoteSingle-company historical lookup with web context
Section titled “Single-company historical lookup with web context”./equity_research_brief.py MSFT --config singleFull multi-step research brief (default)
Section titled “Full multi-step research brief (default)”./equity_research_brief.py NVDA --config researchEmit raw Agent API JSON
Section titled “Emit raw Agent API JSON”./equity_research_brief.py TSLA --json | jq '.usage.cost'Configuration Reference
Section titled “Configuration Reference”| Config | Model | Tools | Max steps | Best for |
|---|---|---|---|---|
quote |
perplexity/sonar |
finance_search |
1 | Live prices, quotes, fastest path |
single |
openai/gpt-5.5 |
web_search + finance_search + fetch_url |
5 | One-company historical fundamentals |
research |
anthropic/claude-opus-4-7 |
web_search + finance_search + fetch_url |
10 | Multi-company comparisons, full brief |
These configurations are taken directly from the finance_search recommended configurations.
Example Output (truncated)
Section titled “Example Output (truncated)”## 1. Snapshot
- **Price:** $200.23 (as of 2026-05-01 14:10 UTC)
- **Market cap:** $4.87T
- **P/E (TTM):** 40.86
- **52-week range:** $110.82 – $216.83
## 2. Business overview
NVIDIA designs accelerated computing platforms — GPUs, networking, and full-stack
software — used in AI training and inference, gaming, professional visualization,
and automotive. Data Center is the dominant revenue line.
## 3. Financial trajectory
| FY | Revenue | Operating margin | Net income |
| ----- | ----------- | ---------------- | ---------- |
| FY25 | $130.5B | 62.4% | $72.9B |
...
---
finance_search: 4 invocation(s) across categories [earnings_history, financials, profile, quote]
Finance sources:
- https://www.perplexity.ai/finance/NVDA
- https://www.perplexity.ai/finance/NVDA/earnings?eventId=409967
- ...
Cost: 0.2817 USDCode Walkthrough
Section titled “Code Walkthrough”The script does three things:
1. Issue a single Agent API call with finance_search enabled.
from perplexity import Perplexity
client = Perplexity()
response = client.responses.create(
model="anthropic/claude-opus-4-7",
instructions=SYSTEM_PROMPT,
input=BRIEF_TEMPLATE.format(ticker="NVDA"),
tools=[
{"type": "web_search"},
{"type": "finance_search"},
{"type": "fetch_url"},
],
max_output_tokens=4096,
max_steps=10,
)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.
for item in response.output:
if item.type == "finance_results":
for r in item.results:
print(r.category, r.tickers, r.sources)
elif item.type == "message":
for block in item.content:
if block.type == "output_text":
print(block.text)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
Section titled “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_searchdoesn't return a field, say so explicitly - format the output in clean Markdown
This pattern is documented in the finance_search prompt guidance.
Pricing
Section titled “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 briefsingle: 1–3 invocations + GPT-5.5 tokensresearch: 3–6 invocations + Claude Opus tokens
See Perplexity Pricing for current rates.
Limitations
Section titled “Limitations”finance_searchis 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