| name | perplexity-core-workflow-b |
| description | Execute Perplexity multi-turn research sessions and batch query pipelines.
Use when conducting in-depth investigations, generating research briefs,
or processing multiple related search queries.
Trigger with phrases like "perplexity research", "perplexity batch search",
"multi-query perplexity", "perplexity deep dive", "perplexity report".
|
| allowed-tools | Read, Write, Edit, Bash(npm:*), Grep |
| version | 1.12.0 |
| license | MIT |
| author | Jeremy Longshore <jeremy@intentsolutions.io> |
| tags | ["saas","perplexity","workflow"] |
| compatibility | Designed for Claude Code, also compatible with Codex and OpenClaw |
Perplexity Core Workflow B: Multi-Query Research
Overview
Multi-turn research workflow using Perplexity Sonar API. Decomposes a broad topic into focused sub-queries, runs them with context continuity, deduplicates citations, and synthesizes a structured research document. Use sonar for fast passes and sonar-pro for deep dives.
Prerequisites
- Completed
perplexity-install-auth setup
- Familiarity with
perplexity-core-workflow-a
PERPLEXITY_API_KEY set
Instructions
Step 1: Conversational Research Session
import OpenAI from "openai";
const perplexity = new OpenAI({
apiKey: process.env.PERPLEXITY_API_KEY,
baseURL: "https://api.perplexity.ai",
});
type Message = OpenAI.ChatCompletionMessageParam;
class ResearchSession {
private messages: Message[] = [];
private allCitations: Set<string> = new Set();
constructor(systemPrompt: string = "You are a research assistant. Provide thorough, cited answers.") {
this.messages.push({ role: "system", : systemPrompt });
}
(: , : | = ): <{
: ;
: [];
}> {
..({ : , : question });
response = perplexity...({
model,
: .,
} );
answer = response.[].. || ;
citations = (response ). || [];
..({ : , : answer });
citations.( ..(url));
{ answer, citations };
}
(): [] {
[....];
}
() {
system = .[];
recent = ..(-(keepLast * ));
. = [system, ...recent];
}
}