Skip to main content

llm-perplexity-agent

Perplexity's Agent API — multi-step web research with citations — as a model for Simon Willison's llm CLI.

llm install llm-perplexity-agent
llm keys set perplexity        # skip if you already set this for llm-perplexity
llm -m perplexity-agent 'What changed in MCP 2026-07-28?'

Why

llm-perplexity wraps Perplexity's older Sonar chat models. This wraps the Agent API (POST /v1/agent) — the multi-step endpoint that runs its own searches, fetches pages, and synthesizes one cited answer. Different product, different endpoint.

Options

llm -m perplexity-agent -o preset xhigh -o recency week 'Latest on X'
llm -m perplexity-agent -o domains 'nasa.gov,-reddit.com' 'Artemis status'
llm -m perplexity-agent -o timeout 600 'Something genuinely deep'
Option Default Notes
preset medium fast, low, medium, high, xhigh, wide-research. Passed through unvalidated — Perplexity declares no enum, so a new preset works the day it ships.
recency — hour, day, week, month, year
domains — Comma-separated; prefix with - to exclude. Max 20.
timeout 300 Seconds before giving up.
spotlight false Wrap the answer as untrusted web content — see below.

Poll progress goes to stderr, so the answer pipes cleanly.

A note on prompt injection

Retrieved web content is untrusted, and this tool feeds it to a language model. The companion MCP server always wraps its answers in a delimiter marking them as untrusted data, because there the answer goes straight into a model that is holding tools — injected instructions could cause actions.

Here the answer goes to your terminal, and llm runs no tool loop by default, so that wrapping is off by default. Turn it on when the output is headed somewhere that matters:

llm -m perplexity-agent -o spotlight true 'Research X' | llm -m gpt-5 'Summarise'

It is a mitigation, not a fix. See SECURITY.md.

Sibling

This is one of two adapters over the same client. The other is perplexity-agent-mcp, an MCP server for Claude Desktop, Claude Code, VS Code and other MCP clients. Both are released together at the same version from one repository.

BSD-3-Clause. Copyright (c) 2026, Constantin Gonzalez.

Metadata

Release files for llm-perplexity-agent 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for llm-perplexity-agent 0.4.0
File Size Uploaded Provenance Actions
llm_perplexity_agent-0.4.0.tar.gz 8.1 kB With provenance Details for llm_perplexity_agent-0.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for llm-perplexity-agent 0.4.0
File Interpreter ABI Platform Actions
llm_perplexity_agent-0.4.0-py3-none-any.whl Python 3 none any Details for llm_perplexity_agent-0.4.0-py3-none-any.whl

Total release size: 17.1 kB

Release files / llm_perplexity_agent-0.4.0.tar.gz

Download URL llm_perplexity_agent-0.4.0.tar.gz
Size 8.1 kB
Tags Source
SHA-256 checksum
How to use checksums
ac57d9bff3acbf81d5eac6cfc2454080e22fac42673303b1dbde12d486666fe6
BLAKE2b-256 checksum
How to use checksums
53d633492df6a932fc8a5969421788a63c0cc475401f18c07be06b21687ca0d2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 2, 2026.

Transparency log

Release files / llm_perplexity_agent-0.4.0-py3-none-any.whl

Download URL llm_perplexity_agent-0.4.0-py3-none-any.whl
Size 9.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
acb4fdf9feecc72fac68aaffc4dbb379807255bbad9f8f6537681748c98b8086
BLAKE2b-256 checksum
How to use checksums
b2260f69ca8f2bef38123e7f09daba4e62943d1c94b47831757be3154ef3276d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 2, 2026.

Transparency log

Security for llm-perplexity-agent 0.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for llm_perplexity_agent-0.4.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 2, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page