ai
Perplexity AI CLI for Coding Agents
Use the Perplexity AI CLI for coding agents with headless JSON commands, schema discovery, credentials, and permission controls.
4 functions 4 read 0 write API key auth
Perplexity AI CLI for Coding Agents
Let coding agents discover schemas and execute integration functions through CLI commands or MCP.
Use this pattern when another coding agent needs exact commands and schema discovery. The Perplexity AI CLI uses the same integration registry as the TUI, Lua runtime, and MCP gateway, but returns predictable command output for automation.
Command Shape
# Perplexity AI CLI for Coding Agents
kosmokrator integrations:configure perplexity --set api_key="$PERPLEXITY_API_KEY" --enable --read allow --write ask --json
kosmo integrations:call perplexity.perplexity_chat '{"messages":"example_messages","model":"example_model","temperature":1,"max_tokens":1,"search_domain_filter":"example_search_domain_filter","return_images":true,"return_related_questions":true,"search_recency_filter":"example_search_recency_filter"}' --json Discovery Before Execution
Agents and scripts can inspect Perplexity AI docs and schemas before choosing a function.
kosmo integrations:docs perplexity --json
kosmo integrations:docs perplexity.perplexity_chat --json
kosmo integrations:schema perplexity.perplexity_chat --json
kosmo integrations:search "Perplexity AI" --json
kosmo integrations:list --json Useful Perplexity AI CLI Functions
| Function | Type | Parameters | Description |
|---|---|---|---|
perplexity.perplexity_chat | Read | messages, model, temperature, max_tokens, search_domain_filter, return_images, return_related_questions, search_recency_filter | Send messages to Perplexity AI for a chat completion response. Supports multi-turn conversations with message history. Returns the assistant response with optional citations and search results. |
perplexity.perplexity_ask | Read | query, model, temperature, max_tokens, search_domain_filter, return_images, return_related_questions, search_recency_filter | Ask Perplexity AI a question and get a concise answer with cited sources. Best for factual queries, research, and knowledge questions. |
perplexity.perplexity_list_models | Read | none | List all available Perplexity AI models. Returns model IDs and their capabilities for use in chat and ask tools. |
perplexity.perplexity_get_current_user | Read | none | Get information about the currently authenticated Perplexity API user, including account details and usage. |
Automation Notes
- Use
--jsonfor machine-readable output. - Keep credentials out of argv by using environment variables or stored KosmoKrator configuration.
- Configure read/write policy before unattended runs; use
--forceonly for trusted automation. - Use the MCP gateway instead when the agent needs dynamic tool discovery inside a conversation.