Decisions/2026-04-08-perplexity-agent-api-integration.md
Perplexity Agent API Integration — Architecture Decisions
Context
Perplexity launched the Agent API (March 2026) — a managed agentic runtime that coordinates 19+ AI models with built-in web search, URL fetching, domain filtering, date range filtering, and structured JSON output. This is fundamentally more powerful than the Sonar API currently used in PRISM's intelligence modules.
Decision 1: Phased Approach — Cost + Quality + Capability
Decision: Pursue all three goals (cost reduction, quality improvement, capability expansion) in a phased rollout. Why: The Agent API enables all three simultaneously. Phase 1 focuses on quality + capability, Phase 2 optimizes cost.
Decision 2: Authoritative APIs Stay as Validation Layer
Decision: Keep BuiltWith, SimilarWeb, Crossbeam, Yahoo Finance, and SEC EDGAR. Agent API does broad research; specialized APIs provide VERIFIED-tier evidence. Why: Zero-hallucination principle is non-negotiable. Any data point without a citation does not exist. Authoritative APIs provide the highest evidence tier. Agent API research gets validated against them. This creates a two-layer verification system: Agent API finds intelligence, specialized APIs confirm it. Implication: Evidence tier hierarchy remains: Government filing > Verified API > Agent API research (with citations) > Company self-reported > LLM inference.
Decision 3: Agent API with Embedded Research Playbooks (not Perplexity Computer Skills)
Decision: Encode research methodologies as Agent API instructions + structured output schemas within PRISM's codebase. Do NOT use Perplexity Computer's UI-based skill system.
Why: PRISM must own the runtime. Skills uploaded to Perplexity Computer can't be called programmatically from Temporal pipelines, can't validate output against Pydantic schemas, can't persist results to PostgreSQL, can't participate in the evidence tier system.
Implication: Research playbooks are Python code + Agent API instructions, not .md files uploaded to a third-party UI.
Decision 4: Research Playbook Abstraction Layer
Decision: Create a new abstraction — research playbooks — that sit between modules and the Agent API. Playbooks are reusable research methodologies that modules compose. Why: The competitive analysis methodology isn't one module — it's used by intel-competitors, audit-browser (competitive search testing), synth-sales-plays (battlecards), and campaign-abx. A playbook layer enables reuse without duplication. Playbooks map 1:1 to the Perplexity skill concept but execute programmatically. Pattern: Module → composes Playbook(s) → Playbook calls Agent API with instructions + structured output schema → validates against Pydantic model → returns typed result.
Decision 5: Competitive Search Benchmarking in audit-browser
Decision: Expand audit-browser to test not just the prospect but also the prospect's competitors. Draw comparative inferences and Algolia value angles from the comparison. Why: "You don't have SAYT but BJ's does" is 10x more compelling than "you don't have SAYT." Competitive benchmarking turns audit findings into urgency signals. Implication: audit-browser's scope grows significantly. May need to be split into audit-browser (prospect) + audit-browser-competitive (competitors) or use the playbook layer to share methodology.
Decision 6: Seven New Research Capabilities
Decision: The following capabilities are in scope for the Agent API integration: 1. Live competitive search benchmarking — Test competitors' search capabilities via research (reviews, tech blogs, case studies, job postings) 2. Executive intelligence mining — Podcasts, conference talks, LinkedIn posts, blog posts about digital strategy 3. Industry gap analysis — Systematic competitive landscape mapping for whitespace opportunities 4. Prospect pain signal detection — Glassdoor, Reddit, app store reviews, Twitter for "search sucks" signals 5. Technology migration intelligence — Job postings, tech blogs for buying intent signals 6. Partner ecosystem mapping — SI/agency/consultant relationships 7. Custom competitive battlecard generation — Structured battlecards with objection handling, landmines, win/loss themes
Decision 7: Cost Ceiling — $25/audit
Decision: Budget ceiling is $25 per full audit at worst case. Expected landing: $8-15 per full audit with Agent API layer.
Why: Even at $25, this is orders of magnitude cheaper than manual research ($300K+ McKinsey equivalent). The value-to-cost ratio is extraordinary.
Implication: Can use deep-research preset for high-value playbooks and pro-search for simpler ones. No need to optimize for cost at the expense of quality.
Decision 8: Deprecate Claude Code Skills — Go All-In on PRISM
Decision: Stop investing in algolia-audit- and algolia-intel- Claude Code skills. Focus all development effort on PRISM. Why: Skills were the prototype that validated the methodology. PRISM is the production system. Skills lack: data persistence, cross-audit intelligence, evidence validation, structured output contracts, parallelism, and automated operation. With the Agent API playbook layer, PRISM absorbs everything skills can do and goes far beyond. Exception: Keep skills as read-only reference — they document research methodology in plain English, useful when writing Agent API instructions for playbooks.