Skip to content

v0.2.0 — optional llm plugin

Choose a tag to compare

@zalez zalez released this 26 Jul 10:58

The same Perplexity Agent client, now reachable two ways: as an MCP server, and as a model for Simon Willison's llm CLI.

llm install 'perplexity-agent-mcp[llm] @ git+https://github.com/zalez/perplexity-agent-mcp@v0.2.0'
llm keys set perplexity        # skip if already set for llm-perplexity
llm -m perplexity-agent 'What changed in MCP 2026-07-28?'

The MCP server is unchanged in how you use it, and still has zero runtime dependencies. The llm adapter is an optional extra the server never imports.

Why this exists

llm has no MCP support — simonw/llm#696 has been open since January 2025 — and the existing llm-perplexity plugin wraps the older Sonar chat models rather than the Agent API. That is the same gap this project already filled for MCP, in a different tool.

It is a second adapter on the same core, not a fork: bands 1–3 of perplexity_agent_mcp.py were already a complete Perplexity Agent client, so every API quirk, retry rule, redirect refusal and payload bound is shared between the two.

Added

  • llm -m perplexity-agent, with -o preset, -o recency, -o domains, -o timeout, -o spotlight
  • Poll progress on stderr, so a long run does not look hung and the answer still pipes cleanly
  • Reuses an existing llm keys set perplexity, and falls back to PERPLEXITY_API_KEY — no extra configuration either way

Changed

  • Importing the server no longer claims the process's stdout. The sys.stdout rebind moved from import time into main(). Importing used to redirect the importing program's entire output to stderr — harmless for the server, fatal for anything reusing the client. The guarantee for the server is unchanged.
  • Build backend is setuptools, was flit_core. flit builds one module per distribution and this project now ships two. setuptools is the only backend that keeps the property flit was chosen for: one package, zero transitive dependencies.
  • Truncated source URLs keep both ends, so two long citations from the same site no longer render identically.

Fixed

  • perplexity_agent_cancel no longer implies a cancellation it cannot confirm — Perplexity returns an identical HTTP 400 whether a run already finished or the id never existed.

Verification

190 tests, green on Python 3.10–3.14. All 9 CI jobs green against this tag, including a job that installs the llm extra and fails if the adapter tests skip.

Full notes in CHANGELOG.md.