Skip to main content

PrimeThink CLI

Command Line Interface for interacting with the PrimeThink API.

Installation

pip install primethink-cli

See the Installation Guide for install scripts, Homebrew, and troubleshooting.

Quick Start

  1. Log in through the browser (it opens the PrimeThink app, where you approve the groups this computer may use):
pt login

Or configure an API token yourself (from Settings → API Keys in the PrimeThink app):

pt profile add --token YOUR_API_TOKEN
  1. Use the CLI:
pt task actions
pt task execute --action "action-name" --message "your message"
pt chat send CHAT_ID --message "your message"
pt chat send --agent AGENT_ID --message "your message"

Commands at a Glance

Command Description
pt version Display the CLI version
pt whoami Show the authenticated user, their groups, active group, and configured providers
pt login Log in through the browser and save a profile (with its own API key) per approved group
pt mcp Run PrimeThink as an MCP server (exposes the API as tools over stdio)
pt install-skill Install the bundled CLI agent skill for Claude Code and compatible agents
pt install-developer-skill Install the complete public PrimeThink developer skill, including nested resources
pt live-app new Scaffold a React or HTML Live App from a GitHub template catalog
pt live-app publish Create/update a Live App task and sync its flat artifact
pt live-app test Sync a Live App into a new or existing chat
pt profile add Configure an API token for a profile
pt profile use Switch the active profile
pt profile list List configured profiles
pt profile rename Rename a profile (e.g. one pt login named after its group)
pt profile remove Remove a profile
pt chat send Send a message to a chat (by ID/mention) or an agent
pt chat list List chats (paginated, filterable by star/archive/workspace/parent chat)
pt chat subchats List a chat's subchats
pt chat create Create a new chat (--from-task-id launches a task into it)
pt chat rename Rename a chat
pt chat goal Update a chat's goal
pt chat type Switch a chat between live-app and chat mode
pt chat messages List a chat's messages (cursor-paginated)
pt chat mark-read Mark a chat read (up to its latest message by default)
pt chat archive / pt chat unarchive Archive / unarchive a chat
pt chat delete Delete a chat (asks for confirmation; --yes to skip)
pt chat list-files List files and directories in a chat
pt chat upload-files Upload local files to a chat
pt chat download-file Download a file from a chat
pt chat delete-file Delete a file from a chat by document ID (asks for confirmation)
pt chat upload-text Create a chat document from raw text (no local file)
pt chat list-users List a chat's members
pt chat invite-members / pt chat remove-members Invite / remove users and agents in a chat
pt chat edit-message / delete-message / clear-messages / retry-message Edit, delete, clear, or retry chat messages
pt chat export-message / save-as-task Export a message (md/docx/pdf) or save a chat as a task
pt chat sync-to Sync a local directory into a chat
pt chat sync-from Sync a chat's files to a local directory
pt chat sync Two-way sync between a chat folder and a local directory
pt chatdb init Initialize a chat's ChatDB (Live App data) store
pt chatdb list List entities in a chat's ChatDB store (or an attached DB Collection via --collection/--collection-id)
pt chatdb get Get one ChatDB entity by ID
pt chatdb add Add one or more rows to a ChatDB entity
pt chatdb update Update ChatDB entities (single or bulk)
pt chatdb delete Delete ChatDB entities (asks for confirmation)
pt collection list List collections (paginated, searchable)
pt collection create Create a collection
pt collection get Fetch a collection's details as JSON
pt collection update Update a collection's fields (name, indexing, …)
pt collection reindex Trigger a reindex of a collection
pt collection copy Duplicate a collection (by UUID)
pt collection delete Delete a collection (asks for confirmation; --yes to skip)
pt collection list-files List files and directories in a collection
pt collection upload-files Upload local files to a collection
pt collection upload-text Create a collection document from raw text (no local file)
pt collection delete-file Delete files from a collection by document ID (asks for confirmation)
pt collection download-file Download a file from a collection
pt collection sync-to Sync a local directory into a collection
pt collection sync-from Sync a collection's files to a local directory
pt agent list List agents (virtual assistants), filterable by name/type/status (--summary trims heavy config)
pt agent get Fetch an agent's details as JSON
pt agent create Create an agent with its type's default capabilities; --capability adds more, --no-default-capabilities sends only those
pt agent update Update fields on an existing agent, including its capabilities (--capability / --add-capability / --clear-capabilities)
pt agent delete Delete an agent (asks for confirmation; --yes to skip)
pt agent types List available agent types
pt agent list-docs List documents in an agent's knowledge base
pt agent upload-docs Upload files to an agent's knowledge base
pt agent attach-collections / pt agent detach-collection Attach / detach collections for agent RAG
pt agent upload-image / pt agent delete-image Upload / delete an agent's image
pt capability list / create / update / delete Manage agent capabilities (list --agent-type shows the capabilities linked to an agent type; create/update --agent-type picks the types a capability is linked to, by default every type of your group)
pt capability archive / unarchive / duplicate Archive, unarchive, or duplicate a capability
pt capability resolve Resolve capability codes/ids to ids
pt models list / pt models embeddings Discover LLM / embedding models from the catalog
pt scheduled-job list / create / update Manage scheduled jobs (prompts on a schedule) in a chat
pt scheduled-job set-status / delete Pause/resume or delete a scheduled job
pt {chat,collection,task,agent} mkdir / rmdir Create / delete a folder in a chat, collection, task, or agent
pt {chat,collection,task,agent} move-dir / rename-dir Move / rename a folder
pt {chat,collection,task} list-versions / new-version / new-text-version Manage a document's versions
pt {chat,collection,task} set-production-version / delete-version Promote or delete a document version
pt workspace list / create / rename / set-goal / delete Manage chat workspaces
pt workspace archive / pin / add-chat / remove-chat Organize chats within workspaces
pt tag list / create / assign List, create, and assign tags (task/agent/capability/collection)
pt suite build / validate / inspect Build, check and describe a .ptsuite package (apps, tasks, agents, collections, tags, workspace)
pt suite install / uninstall Plan (--dry-run) and install/upgrade a package idempotently from a file, folder, GitHub or the catalog; remove what it created
pt suite export Turn live tasks and Live Apps (with their agents and collections) into a package folder
pt suite catalog build / list / search Index a folder/GitHub repo of packages and browse it
pt group list / get / create / update / delete Manage groups (organizations)
pt group members / remove-member / invite / add-agent Manage group members, invites, and agents
pt settings list / get / set / delete Manage group/user settings, provider API keys and custom variables (--private, --sandbox-injectable; secrets never shown)
pt user list / search Look up users you can see by name or email
pt notification list / unread-count List your notifications or count the unread ones
pt notification mark-read / mark-unread / mark-all-read / delete Mark notifications read/unread, mark all read, or delete one
pt inbox Show unread notifications and chats with unread messages
pt events Stream real-time events (notifications, unread chats, messages, agent replies) as JSON lines
pt wait Wait for the next matching event, print it, and exit (124 on timeout)
pt task list List tasks, filterable by name/type/status and paginated
pt task actions List available task actions
pt task execute Execute a task action with a message and optional files
pt task create Create a task (supports schedules, page type, and more)
pt task update Update fields on an existing task
pt task get Fetch a task's details as JSON
pt task upload-text Create a task document from raw text (no local file)
pt task add-docs / pt task delete-docs Add / delete task knowledge documents
pt task delete Delete a task (asks for confirmation; --yes to skip)
pt task duplicate Duplicate a task
pt task set-public / pt task set-private Make a task public / private
pt task publish Create/update a task from a project directory (--type, feature toggles, optional task.json)
pt task launch Launch a task into a new chat, optionally inside a workspace
pt task test Sync a task goal into a new or existing chat
pt task export Export a task's portable config as JSON (for pt task import)
pt task import Create a new task from an exported JSON file (deploy across environments with --profile)
pt task create-version Snapshot a task's current state as a named version
pt task upload-image Upload an image for a task
pt eval list / add / update / delete Manage a task's evaluation-data set (the test plan)
pt eval settings Configure a task's evaluation settings (schedule, evaluator, thresholds)
pt eval run / runs / run-get / results / download Run a task evaluation and inspect its runs and results
pt eval simulate / simulations / delete-simulation Run and manage agent-vs-agent task simulations
pt search documents Semantic search across documents in a vector store collection
pt search chat Semantic search within a chat
pt search collection Semantic search within a collection
pt search messages Semantic search across one chat's messages
pt search images Search a collection's images by example image and/or text
pt image generate Generate an AI image and save it locally
pt voice stt / tts / diarize / translate Transcribe, synthesize, diarize, or translate audio
pt video analyze Analyze a video file

Every command that calls the API also accepts --profile (use a specific profile for one request) and --api-url/-u (override the API URL for one request). See the full CLI reference for every option and example.

--help works in either position: pt chat send --help, pt chat --help send, and pt --help chat send all print the same page.

Tip: -p is the short flag for --profile in most groups (e.g. pt task, pt agent, pt search, pt settings, pt user, pt notification, pt eval), pt image generate, and pt whoami, but in the pt chat and pt collection groups there is no -p for profile — there -p means --path (a directory inside the chat/collection) on the file commands. Use the long form --profile when in doubt.

Configuration

Token Management

The CLI supports multiple token profiles, allowing you to switch between different accounts or API endpoints.

# Log in through the browser: one profile per group you approve
pt login
pt login --no-browser --expires-in-days 30   # print the link instead; 30-day keys

# Configure a profile (creates it, or overwrites an existing one)
pt profile add --token YOUR_API_TOKEN --profile default

# Optionally with a custom API URL
pt profile add --token STAGING_TOKEN --profile staging --api-url https://staging-api.example.com

# List, switch, rename, remove
pt profile list
pt profile use staging
pt profile rename staging qa
pt profile remove old-profile

Options for pt profile add:

  • --token, -t: Your API token (required)
  • --profile, -p: Profile name (default: "default")
  • --api-url, -u: Custom API URL (optional, default: https://api.primethink.ai)

Configuration File

The CLI stores configuration in ~/.primethink/config.json:

{
  "active_profile": "default",
  "profiles": {
    "default": {
      "token": "your-api-token"
    },
    "staging": {
      "token": "your-staging-token",
      "api_url": "https://staging-api.example.com"
    }
  }
}

Keep this file secure — it contains your API tokens. The CLI writes it with mode 600 (readable only by you); for a file written by an older version, run chmod 600 ~/.primethink/config.json.

Environment Variables

All environment variables are optional overrides — when unset, the CLI uses the config file and its built-in defaults:

Variable Description Default when unset
PRIMETHINK_TOKEN API token, bypassing the config file (useful for CI/CD) Token from the active profile
PRIMETHINK_API_URL API base URL override Profile's api_url, otherwise https://api.primethink.ai
PRIMETHINK_PROFILE Profile to use when --profile is not passed The active profile
PRIMETHINK_CONFIG_PATH Custom config file path ~/.primethink/config.json
PRIMETHINK_DEBUG Set to 1 to print request/response debug info to stderr Disabled

Precedence, highest first: command-line flag → environment variable → config file → built-in default. See docs/install.md for details.

Usage Examples

Messaging and actions

# List available actions, optionally with a specific profile
pt task actions
pt task actions --profile production

# Execute an action with attachments
pt task execute --action summarize --message "Summarize these" --files q1.pdf --files q2.pdf

# Message a chat by ID or mention name
pt chat send 123 --message "Hello from the CLI"
pt chat send @my-assistant --message "Review this" --files report.pdf

# Fire-and-forget (don't wait for the response)
pt chat send 123 --message "Long-running job" --async

# Message an agent directly
pt chat send --agent 1 --message "Analyze this data" --files data.csv

Managing chats

# Find a chat
pt chat list --search onboarding --starred

# Create one, then adjust it
pt chat create --name "Q3 planning" --goal "Track the Q3 launch" --virtual-assistant-id 7
pt chat rename 123 "Q3 planning (final)"
pt chat goal 123 --goal-file ./new-goal.md

Reacting to activity

Agents and scripts can listen for notifications, unread chats and agent replies instead of polling:

# What is waiting right now
pt inbox --with-messages 3

# Block until something new arrives (returns at once if something is already unread)
pt wait --pending --timeout 900

# Send without waiting, then wait for the reply in that chat
pt chat send 123 -m "Ready for review?" --async          # prints user_message_id
pt wait --chat 123 --after-message-id 4567 --type message   # data.type "thinking" = an agent reply still being written

# Clear a chat you handled
pt chat mark-read 123

# Stream everything as JSON lines (reconnects and re-syncs on its own)
pt events

See Events and inbox for the event format and agent recipes.

Chat and collection files

# Browse and fetch chat files
pt chat list-files 123
pt chat download-file 123 456 --output report.pdf

# Mirror a local folder into a chat (PDFs only, including subfolders)
pt chat sync-to 123 ./reports --pattern '*.pdf' --recursive

# Back up a whole chat workspace locally
pt chat sync-from 123 ./chat-backup

# Collections work the same way, plus discovery
pt collection list --search contracts
pt collection sync-to 42 ./knowledge-base --recursive
# Search a chat, a collection, documents, or messages by meaning
pt search chat 123 "what did we decide about the deadline"
pt search collection 42 "termination clause" --top-k 3
pt search documents "refund policy" --collection-name kb
pt search messages "standup notes" --chat-id 5 --user-id 2

Agents

# Discover agent types, then create an agent
pt agent types
pt agent create --name "Support bot" --public-description "Answers support questions" --type-id 1
# --capability adds to the type's default capabilities (base, goal, memory, …)
pt agent create --name "Searcher" --public-description "Searches the web" --type-id 1 --capability web_search

# Find, inspect, adjust
pt agent list --search support
pt agent get 7
pt agent update 7 --description-file ./instructions.md

# Message an agent (same command as chat messaging)
pt chat send --agent 7 --message "Analyze this" --files data.csv

Tasks

# Create a scheduled task
pt task create \
  --name "Morning briefing" \
  --description "Daily news summary" \
  --type private \
  --virtual-assistant-id 7 \
  --schedule-nl "every weekday at 8am" \
  --schedule-prompt "Prepare the morning briefing"

# Inspect and update it
pt task get 99
pt task update 99 --schedule-nl "every weekday at 7am"

# Snapshot a version, add a cover image
pt task create-version 99 --version-name "v2"
pt task upload-image 99 ./cover.png

# Export the task config, check it into git, deploy it elsewhere
pt task export 99 --output tasks/briefing.json
pt task import tasks/briefing.json --profile production

# Publish a conventional task project (GOAL.md required); pass an ID to update
pt task publish ./tasks/briefing --virtual-assistant-id 7
pt task publish ./tasks/briefing --virtual-assistant-id 7 --type group --chat-history --docs-enabled --scheduled-jobs
pt task publish ./tasks/briefing --task-id 99 --virtual-assistant-id 7

# Launch a task into a chat (optionally inside a workspace), as the web app does
pt task launch 99 --workspace-id 738

# Make the resulting task public/private, or test its goal in a chat
pt task set-public 99
pt task set-private 99
pt task test ./tasks/briefing
pt task test ./tasks/briefing --chat-id EXISTING_CHAT_ID

# Generate an image with AI
pt image generate --prompt "A lighthouse at dawn" --output lighthouse.png

Live App Workflows

Scaffold a new Live App project without configuring an API profile:

# Default: React + Tailwind + Flowbite
pt live-app new ./my-live-app

# Other common variants
pt live-app new ./simple-html --framework html --no-flowbite
pt live-app new ./plain-react --no-tailwind --no-flowbite

# Use a custom catalog and pin it for reproducible generation
pt live-app new ./my-live-app \
  --repo-url https://github.com/acme/primethink-templates \
  --ref v2.0.0

The destination must not already exist. Flowbite requires Tailwind. The command downloads a public GitHub repository and selects a template from live-app-templates/manifest.json; it never runs npm install or generated code.

After building, publish the Live App as a task or synchronize it directly into a test chat. Artifact discovery checks dist/, then app/, then the project root; use --app-dir to override it. The artifact must contain index.html (or canvas.html, deployed as index.html) and should be flat.

# Create a Live App task; add --task-id 123 to update it
pt live-app publish ./my-live-app --virtual-assistant-id 7
pt live-app publish ./my-live-app --task-id 123 --virtual-assistant-id 7

# Create a temporary test chat, or update an existing chat in place
pt live-app test ./my-live-app
pt live-app test ./my-live-app --chat-id EXISTING_CHAT_ID

# Change any chat's renderer explicitly
pt chat type EXISTING_CHAT_ID live-app
pt chat type EXISTING_CHAT_ID chat

Project metadata follows the reference-script conventions: .name.config, .description.config, GOAL.md, and optional INITIAL_PROMPT.md; .image.png is uploaded when publishing a Live App. Existing same-named app documents receive a new Production version, while identical content is reported as unchanged.

Automated Live App UI testing is no longer a pt command. It now lives in the primethink-developer skill as a deterministic, plan-driven workflow: the skill authors a reviewable tests/test_plan.yaml, runs it with a bundled Playwright runner (no LLM in the execution loop), reads the structured results, and heals failing selectors before re-running. Install it with pt install-developer-skill.

MCP Server

The same code that powers the pt CLI can run as an MCP server, exposing the core PrimeThink API management operations as tools for MCP clients (Claude Code, Claude Desktop, and others) to call directly — no shelling out to pt. Local scaffolding and project publish/test orchestration remain CLI workflows.

The MCP SDK is an optional dependency, so CLI-only installs stay lean:

pip install 'primethink-cli[mcp]'   # requires Python 3.10+
pt mcp                              # serve over stdio

Authentication reuses the same profiles and environment variables as the CLI. Point your MCP client at pt mcp and provide a token via the server's env, for example (Claude Desktop / Claude Code mcpServers config):

{
  "mcpServers": {
    "primethink": {
      "command": "pt",
      "args": ["mcp"],
      "env": { "PRIMETHINK_TOKEN": "your-api-token" }
    }
  }
}

Without PRIMETHINK_TOKEN in the client config, the server falls back to your configured active profile (~/.primethink/config.json); individual tools also accept optional profile and api_url arguments. Core API management operations have tool equivalents — messaging, chats, collections, tasks, agents, semantic search, and image generation. See the CLI reference for the full tool list.

Agent Tools Plugin

Beyond the CLI and MCP server, the package also ships the agent tools plugin (primethink_agent_tools) — it exposes the PrimeThink admin/management API (tasks, agents, chats, collections) as LangChain tools for PrimeThink agents, reusing the same client code as pt. It's enabled by the optional agent-tools extra, so plain CLI installs stay lean (no langchain) and the plugin is installed only in the agent runtime / API image:

pip install 'primethink-cli[agent-tools]'

The PrimeThink API discovers it automatically via the primethink.tools entry point. Authentication uses a per-user ADMIN_PRIMETHINK_API_TOKEN setting. See docs/agent-tools.md for the tool list, auth, and setup.

Agent Skills

The CLI supports two complementary Agent Skills:

  • primethink-cli teaches agents how to use pt. It ships inside the pip package and installs offline with pt install-skill.
  • primethink-developer teaches agents to build PrimeThink Live Apps, Tasks, and SDK integrations. It is downloaded free from the public primethink-app-templates repository with every nested library and reference file.
# Install either skill for all projects (~/.claude/skills)
pt install-skill
pt install-developer-skill

# Install the developer skill only for the current repository
pt install-developer-skill --project

# Custom skills directory / upgrade an existing installation
pt install-developer-skill --dir ~/.config/my-agent/skills
pt install-developer-skill --force

# Pin the public source for reproducibility
pt install-developer-skill --ref main

Neither installer needs a PrimeThink API token. install-developer-skill needs internet access but no paid service or GitHub credentials; --force replaces the complete existing primethink-developer/ folder only after the replacement archive has been downloaded and staged successfully.

Documentation

Development

# Install development dependencies
pip install -e ".[dev]"

# Run tests
pytest -q

# Run tests with coverage
pytest -q --cov=primethink --cov-report=html

See the Developer Guide for architecture notes and the release process.

License

MIT License

Support

For issues and questions, please visit: https://primethink.ai

Metadata

Release files for primethink-cli 1.10.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 primethink-cli 1.10.0
File Size Uploaded Provenance Actions
primethink_cli-1.10.0.tar.gz 497.7 kB Without provenance Details for primethink_cli-1.10.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for primethink-cli 1.10.0
File Interpreter ABI Platform Actions
primethink_cli-1.10.0-py3-none-any.whl Python 3 none any Details for primethink_cli-1.10.0-py3-none-any.whl

Total release size: 671.5 kB

Release files / primethink_cli-1.10.0.tar.gz

Download URL primethink_cli-1.10.0.tar.gz
Size 497.7 kB
Tags Source
SHA-256 checksum
How to use checksums
32d84a607a8e0e3bb8a7ba72835748ab7c26927538d313b51a7c209fa7f03381
BLAKE2b-256 checksum
How to use checksums
a75678d0bfabcaccff80eddcc3d506db7666a591bade2f6bfedc550acdb69d87
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.6

Release files / primethink_cli-1.10.0-py3-none-any.whl

Download URL primethink_cli-1.10.0-py3-none-any.whl
Size 173.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f1c7a470949661587458f834604afd63e81f0b983bde21d3ea7cde72a83267c5
BLAKE2b-256 checksum
How to use checksums
f5e4be8624dc7d01244ac48af8b180544d83924b3a18a69afda904b5dbcec8ae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.6

Security for primethink-cli 1.10.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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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