Skip to main content
Perplexity

Search documentation

Type to search this documentation.

On this pageOverview

Prompt the agent

An agent has two prompt surfaces, and keeping them distinct matters. instructions is the agent's system prompt — the rules that hold on every turn. input is the specific thing to do this turn. When retrieval tools are enabled, input is also what the model uses to decide whether and what to search. This page draws the line between the two and shows how to ground the run on retrieved evidence.

Field What goes here
instructions The system prompt: role, tone, output language, citation and formatting rules, and hard do/don'ts. Applied on every turn of the loop, independent of the question.
input The question or task for this turn. It guides tool selection, and when retrieval is enabled, it is what the model searches on, so a more specific input produces more targeted retrieval.

A useful principle: if a rule should still apply when the user asks something completely different, it belongs in instructions (the system prompt). If it is about this request, it belongs in input.

Python
from perplexity import Perplexity

client = Perplexity()

response = client.responses.create(
    model="openai/gpt-5.6-sol",
    instructions=(
        "You are a financial analyst. Always cite sources by domain, "
        "and never speculate beyond retrieved evidence."
    ),
    input="Which operating segments did Apple report in its most recent annual 10-K, and how did each contribute to revenue?",
    tools=[{"type": "web_search"}],
)

print(response.output_text)
TypeScript
import Perplexity from '@perplexity-ai/perplexity_ai';

const client = new Perplexity();

const response = await client.responses.create({
  model: 'openai/gpt-5.6-sol',
  instructions:
    'You are a financial analyst. Always cite sources by domain, and never speculate beyond retrieved evidence.',
  input: 'Which operating segments did Apple report in its most recent annual 10-K, and how did each contribute to revenue?',
  tools: [{ type: 'web_search' as const }],
});

console.log(response.output_text);
cURL
curl https://api.perplexity.ai/v1/agent \
  -H "Authorization: Bearer $PERPLEXITY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai/gpt-5.6-sol",
    "instructions": "You are a financial analyst. Always cite sources by domain, and never speculate beyond retrieved evidence.",
    "input": "Which operating segments did Apple report in its most recent annual 10-K, and how did each contribute to revenue?",
    "tools": [{ "type": "web_search" }]
  }' | jq

Grounding keeps the agent answering from retrieved evidence rather than from the model's own priors. Two levers do most of the work:

  • Specific input. When retrieval tools are enabled, the model searches based on input. "Apple FY2025 10-K revenue by operating segment" retrieves more targeted results than "how is Apple doing." Name entities, time ranges, and the unit of the answer.
  • Retrieval tools. Enable web_search and related tools so the agent pulls live evidence. See Give it tools.

For hard constraints — allowed domains, date ranges, region — prefer request parameters over prose. They are enforced rather than merely requested:

Python
tools=[{
    "type": "web_search",
    "filters": {
        "search_domain_filter": ["sec.gov"],
        "search_after_date_filter": "01/01/2026",
    },
}]

A grounded answer comes with its evidence. Retrieval tools attach their results to the response output array (for example search_results items alongside the message), so you can surface citations or verify claims. See the per-tool reference pages — starting with Web Search → Response shape — for exact response shapes.

Suggest an edit

Propose a replacement for this page. The site team reviews it before applying any changes.

Export
Documentation menu