Skip to main content

Perplexity's Agent API as a model for Simon Willison's llm CLI.

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llm_perplexity_agent-0.3.0.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llm_perplexity_agent-0.3.0-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file llm_perplexity_agent-0.3.0.tar.gz.

File metadata

  • Download URL: llm_perplexity_agent-0.3.0.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for llm_perplexity_agent-0.3.0.tar.gz
Algorithm Hash digest
SHA256 4b8f613b5bacd3aff1ad778246d28256467dd9b3b417aba7017679217f88498b
MD5 b382264cc06a2a60fcb604f04e16463e
BLAKE2b-256 93f6b645a8fb9c825f57a887a23c940e391e6823d960a4eab439862d9c4205b0

See more details on using hashes here.

Provenance

The following attestation bundles were made for llm_perplexity_agent-0.3.0.tar.gz:

Publisher: publish.yml on zalez/perplexity-agent-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file llm_perplexity_agent-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for llm_perplexity_agent-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 04e414a1c05f77d63a576078f486a17d7952c3c3a6b4f43a96997202094c1ced
MD5 55f124badc652b3dd3bb35a4f0f704bb
BLAKE2b-256 b7350a0b79f963ef155fa6300e586c5ac553165b28523614624221a943e77ec4

See more details on using hashes here.

Provenance

The following attestation bundles were made for llm_perplexity_agent-0.3.0-py3-none-any.whl:

Publisher: publish.yml on zalez/perplexity-agent-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page