PTENES
MODULE 4.1

🔎 Live research with Perplexity

Phase 1 of the Factory. It’s what keeps the package up to date instead of static: Perplexity searches for the company on the spot, across nine categories, and returns sourced facts. Even when a search fails, the pipeline continues.

6
Topics
~60
Minutes
Advanced
Level
Phase 1
Pipeline
1

📡 Why Live Research

An LLM on its own responds with what it learned during training — and training has a cutoff date. Ask it about the client's company and it makes up data or uses outdated data. Live research solves this: Perplexity searches the internet for the company when you run the Factory.

✗ LLM only (static)

  • ✗Knowledge frozen as of the cutoff date
  • ✗Makes up plausible numbers and facts (hallucinates)
  • ✗Doesn’t see yesterday’s news or yesterday’s funding round
  • ✗Recommends a tool that has already been replaced

✓ With live research

  • ✓Ran in June/2026 → pulls data through June/2026
  • ✓Facts with citable sources, not guesses
  • ✓If n8n is replaced, it knows
  • ✓Recommendations update automatically
past today Static LLM — stops at the cutoff date ⛔ gap Live research — reaches the present

💡 The phrase that defines Phase 1

"That’s what keeps everything up to date instead of static." Live research is what separates a generic package from a diagnosis that speaks to present of that company. Without it, you deliver a template; with it, you deliver consulting.

Freshness

today's facts

Sources

citable

No guessing

less hallucination

Auto-update

keeps up with the market

2

⚖️ Quick vs Deep and cost

The Factory has two research modes, and you choose between them in real time to control costs. The mode quick runs a quick assessment with the essential queries; the comprehensive investigates deeply, using more expensive models.

ModeQueriesModelsCostWhen to use
Quick~9sonar~US$0.05quick assessment, lead, demo
Comprehensive~18sonar, sonar-pro, deep-research~US$0,50complete strategy, paying client
S

sonar — the workhorse

Cheap and fast. Runs the high-priority queries in quick mode. That’s enough to understand the essentials of the company.

P

sonar-pro — more in-depth

Richer, more expensive responses (US$0,015/1K output). Use comprehensive for categories that need detail.

D

deep-research — the investigation

For topics worth a deep dive — competition and AI initiatives. Only in comprehensive mode, where the cost is justified.

💡 Cost rule of thumb

Always start with quick to qualify the lead. Move up to comprehensive only once the client is committed—the 10× cost difference (US$0,05 → US$0,50) is still just cents compared with what you charge for the package.

Quick

9 queries · sonar

Deep

18 queries · pro/deep

Choice

in real time

Margin

cost < US$1

3

🗓️ Temporal context in queries

A query without a date returns results from any time. The Factory injects the current date into each template through the TemporalContext — and defines a recency filter (day, week, month, or year) by category.

// template before and after temporal injection

# template cru (placeholders)
"{company_name} latest news announcements {current_month_year}"

# renderizado para junho de 2026
"Stripe latest news announcements June 2026"
recency_filter = "month"   # só notícias do último mês

✓ With temporal context

  • ✓{current_year} e {current_month_year} become the actual date
  • ✓News filtered by month; industry per year
  • ✓"this month" means this month, literally

✗ No temporal context

  • ✗Mixing a 2022 article with yesterday’s
  • ✗"latest news" becomes a pile of undated information
  • ✗The diagnosis starts out of date

💡 Recency by category

AI news and initiatives require month (change quickly). Company profile, industry, and regulations hold up year. Matching recency to the topic's volatility is what prevents noise.

Injection

date in the queries

Recency

day/week/month/year

Placeholders

{current_year}

Freshness

in the present

4

🗂️ The 9 query categories

The research covers the company through nine lenses. Each template includes a category, a priority (1 = highest) and a flag required_for_quick_mode — it decides whether the query goes straight into quick mode.

🏢 Company

Business model, products, size, headquarters. The foundation of the profile.

📈 Industry

Market size, trends, challenges, and opportunities.

⚔️ Competition

Who the rivals are and how they adopt AI.

🧰 Technology

The company’s stack, platforms, and infrastructure.

🤖 AI initiatives

Company AI projects, adoption, and industry use cases.

⚖️ Regulatory

Industry rules, AI compliance, and data privacy.

📰 News

Recent announcements and developments (recency month).

👔 Leadership

CEO, executives, and management team.

💵 Investment

Rounds, valuation, and investors.

📊 Who enters quick mode

  • •Always (quick): company, industry, competition, AI, and news — the lenses that answer "the essentials".
  • •Only in comprehensive: leadership, investment, detailed tech stack, and regulatory — the deep dive.
  • •A priority orders the execution: priority 1 runs first.
9 lenses

company→news

Priority

1 = first

Quick flag

does it make the quick cut?

Coverage

the whole company

5

🛟 Aggregate and handle (graceful degradation)

APIs fail. One query times out, another hits the rate limit. The Factory doesn’t get stuck because of that: the Perplexity client has exponential backoff retry and if the search still fails, the pipeline continues with partial data.

// client resilience policy

max_retries        = 3
initial_delay      = 1.0   # segundos
max_delay          = 30.0
backoff_multiplier = 2.0   # 1s → 2s → 4s ...
rate_limit         = 2.0   # pausa entre chamadas Perplexity
1.
Try the query. If it fails, wait (1s, 2s, 4s) and try again, up to 3 times.
2.
Ran out of attempts? Marks that category as failed — but doesn’t take down the others.
3.
Continue with what you have. ResearchOutput starts with the data that worked. Synthesis works with the partial data.

✓ Graceful degradation

  • ✓Query fails → continues with partial data
  • ✓Deliverable fails → flag it and continue with the others
  • ✓Diagram fails → skip the image, keep the markdown

✗ No degradation

  • ✗One failure brings down the entire session
  • ✗Redo everything (and pay again) because of one error
  • ✗Rate limit becomes a wall instead of a pause

💡 Partial > nothing

A package with 8 of the 9 categories is still a deliverable package — you note the gap and move on. Resilience isn’t about never failing; it’s about failing without falling apart.

Retry

3× with backoff

Rate limit

2s pause

Partial

continues anyway

Robust

doesn't fall apart

6

📥 Assemble the ResearchOutput

The end of Phase 1 is a structured object: the ResearchOutput. It brings together everything the research found and turns it into the contract that Synthesis consumes — besides being saved in research_cache.json so you don't research (or pay) twice.

// the object that closes Phase 1

class ResearchOutput:
    company_name: str          # "Stripe"
    raw_research:  dict         # categoria → achados
    sources:       list         # URLs citáveis
    cost:          float        # quanto custou a pesquisa
1

Aggregate by category

Each Perplexity response is saved under its category in raw_research. Synthesis knows where to find "competitors" or "pain points".

2

Keep the sources

The URLs go to sources. It’s what makes citations possible and gives the final package credibility.

3

Caches to disk

Everything goes to research_cache.json. Running Synthesis again doesn’t trigger new research—direct savings.

💡 Structured output is a contract

When Phase 1 delivers a predictable object, Phase 2 becomes reliable. The ResearchOutput is the clean boundary between research and writing—and caching turns cents into zero on the second run.

Structured

predictable object

Sources

citable

Cache

doesn't pay 2×

Contract

feeds Phase 2

✅ Module summary

✓
Live research > static — Perplexity searches for the company’s current state, with sources.
✓
Quick vs Deep controls cost — sonar (~US$0,05) or sonar-pro/deep-research (~US$0,50).
✓
Temporal context and 9 categories — injected date, recency by topic, full company coverage.
✓
Graceful degradation → ResearchOutput — fails without collapsing and closes with a cacheable object.

🎯 Mission 4.1 — Quick research on 1 company

Run Phase 1 in quick mode for a company you know and review the results for the 9 categories.

  1. Ask Claude Code: "run the research quick from the Factory to company X".
  2. Check that the queries came out with a current date injected.
  3. Open the research_cache.json and see the 9 categories and the sources.
  4. Note which category scored lowest — that’s where deep mode would help.

Success: one ResearchOutput structured, with sources, for ~$0.05. What you gained: the factual raw material that feeds the 15 prompts in the next module.

Next module:

4.2 — The 15 deliverable prompts (Phase 2: Assessment, Planning, Implementation, Governance, and Resources)