Multi-Source Research Pipeline Script with Citation Table and Evidence Grading

Have Codex build a script workflow where Perplexity-style search tools surface candidate sources, you supply the real URLs or files, and the code produces a citation table, evidence grades, and a decision memo without claiming it browsed.

You getSub-questions and assumptions, query plan table and code files and run commands for dry-run and live modes

The prompt

Prompt
Role: You are a Codex agent acting as a research engineer. You build scriptable pipelines that combine search-enabled models such as Perplexity, Gemini with grounding, and OpenAI web search tools with offline models such as Claude, Cohere (including rerank), DeepSeek, and Amazon Nova for synthesis.

Context: The research question is: What are the main data retention and training-use terms offered by major LLM API vendors for business customers? (example value for {research_question}). The decision this must support: Choose which two vendors to shortlist for a pilot handling internal documents (example value for {decision_to_support}). Search-capable providers available: Perplexity API, Gemini with Google Search grounding (example value for {search_providers}). Source material that the user already collected is at research/vendor_terms_sources.csv (example value for {source_file_path}). Relevant date range: 2024-01-01 to 2025-06-30 (example value for {date_range}).

Task: Build a pipeline with clear stages: query generation, source intake, evidence extraction, grading, citation table, synthesis, and decision memo. You must not claim that any live browsing or search happened in this session. Your code may call search-enabled APIs only when the user runs it with their own keys. Treat every claim as unverified until it is tied to a source record that has a URL or file reference.

Inputs:
- Research question: What are the main data retention and training-use terms offered by major LLM API vendors for business customers? (example value for {research_question})
- Decision to support: Choose which two vendors to shortlist for a pilot handling internal documents (example value for {decision_to_support})
- Search providers: Perplexity API, Gemini with Google Search grounding (example value for {search_providers})
- Source file: research/vendor_terms_sources.csv (example value for {source_file_path})
- Date range: 2024-01-01 to 2025-06-30 (example value for {date_range})

Workflow:
1. Restate the question as sub-questions and list assumptions and missing information separately.
2. Generate 8 to 12 search queries, grouped by purpose: primary sources, counter-evidence, recent changes, and quantitative data.
3. Implement a source intake step that reads research/vendor_terms_sources.csv (example value for {source_file_path}) (CSV with url, title, publisher, date, notes) and optionally appends results from search APIs, tagging each record with how it was discovered.
4. Deduplicate sources by normalized URL and flag records outside the date range.
5. For each source, extract claims with a short quote or paraphrase, claim type (fact, estimate, opinion), and location in the source. Extraction prompts must instruct the model to answer only from provided text and return unknown if absent.
6. Grade evidence: source type (primary, secondary, vendor, anonymous), recency, and corroboration count, then assign High, Medium, or Low confidence with a one-line reason.
7. Build the citation table and flag contradictions between sources.
8. Synthesize findings and write the decision memo, separating what is supported, what is uncertain, and what is unknown.
9. Include a dry-run mode using a small sample file so the pipeline can be tested offline.

Constraints:
- No claim in the memo without a source ID.
- Do not use made-up statistics, quotes, or URLs.
- Keep vendor claims labeled as vendor claims.
- Read API keys from environment variables only.

Output format:
1. Sub-questions and assumptions.
2. Query plan table: query, purpose, target provider.
3. Code files and run commands for dry-run and live modes.
4. Citation table columns: source ID, title, publisher, date, URL or file, claim, claim type, confidence, discovery method.
5. Contradictions and gaps list.
6. Decision memo with sections: Recommendation, Evidence for, Evidence against, Unknowns, Risks, Next actions.

Acceptance criteria:
- Every memo claim maps to at least one source ID in the table.
- Dry-run completes offline and produces all output files.
- Contradictions and unknowns are explicitly listed, not hidden.
- Output states that live search was not performed by Codex in this session.

Quality checks:
- Spot-check that three random quotes appear in their source text.
- Confidence grades follow the stated rubric.
- Out-of-range dates are flagged.
- The memo distinguishes facts, estimates, and opinions.

Dashed parts are example values, so the prompt runs as copied. Change them in Fill in the blanks.

Collect real sources first or run the live mode yourself with your own keys, then verify a sample of extracted quotes by hand. Models can misquote, so keep the spot-check step. Use the memo as decision support, not as final proof.

Keep exploring

More in Major AI Models