@agentapprove/pi

Agent Approve extension for Pi - approve or deny AI agent tool calls from your iPhone and Apple Watch

Packages

Package details

extension

Install @agentapprove/pi from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:@agentapprove/pi
Package
@agentapprove/pi
Version
0.1.16
Published
Nov 13, 2026
Downloads
5,042/mo · 830/wk
Author
jbeno
License
SEE LICENSE IN LICENSE
Types
extension
Size
97.3 KB
Dependencies
0 dependencies · 0 peers
Pi manifest JSON
{
  "extensions": [
    "./dist/index.js"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

@agentapprove/pi

Agent Approve extension for Pi. Approve or deny Pi tool calls from your iPhone or Apple Watch. Get the app on the App Store.

Install

Run the Agent Approve installer and select Pi:

npx agentapprove

If Agent Approve is already paired on this machine, you can install the Pi package directly:

pi install npm:@agentapprove/pi@0.1.16

What It Covers

  • tool_call blocking approval
  • native tool completion events
  • MCP tool approvals and completion events grouped by MCP server
  • prompt, response, thinking, compaction, stop, and session-end events
  • optional follow-up input from Agent Approve when Pi finishes a turn

Runtime Mapping

Pi event Agent Approve event
session_start session_start
before_agent_start user_prompt
tool_call blocking approval request
tool_result command_executed, tool_complete, or mcp_complete
tool_execution_end completion fallback if tool_result was not observed
message_end thought, response, or plan_generated
session_compact context_compact
agent_end stop, with optional follow-up input
session_shutdown session_end

Approval requests include:

{
  agent: "pi",
  hookType: "tool_call",
  toolName: string,
  toolType: string,
  toolInput?: object,
  command?: string,
  conversationId: string,
  generationId?: string,
  toolCallId?: string,
  model?: string,
  mcpServer?: RuntimeMcpServer,
  metadata: {
    sessionId: string,
    piEventName: "tool_call",
    cwd?: string,
    workspaceRoots?: string[],
    turnId?: string,
    messageId?: string,
    provider?: string,
    model?: string,
    toolCallId?: string
  },
  timestamp: number
}

Events use the same Agent Approve event envelope with agent: "pi", eventType, conversationId, optional generationId, optional tool metadata, optional mcpServer, optional sessionStats, metadata, and timestamp.

Configuration

The extension reads the standard Agent Approve config from ~/.agentapprove/env.

Variable Default Description
AGENTAPPROVE_API https://api.agentapprove.com Agent Approve API URL
AGENTAPPROVE_API_VERSION v001 API version
AGENTAPPROVE_TOKEN keychain or config token CLI API token
AGENTAPPROVE_PRIVACY full minimal, summary, or full
AGENTAPPROVE_FAIL_BEHAVIOR ask allow, deny, or ask if Agent Approve is unreachable (see below)
AGENTAPPROVE_AGENT_NAME Pi Display name for this Pi agent
AGENTAPPROVE_PI_NAME Pi Legacy Pi-specific display name fallback

The privacy tier controls stored history only. Approval requests always carry the full command and tool input (encrypted when E2E is on), so your policy and your phone see what will actually run.

When no decision can be obtained

AGENTAPPROVE_FAIL_BEHAVIOR applies whenever the extension cannot get a decision from Agent Approve: no token is configured, the service cannot be reached or does not answer in time, it answers with an error status or a response that cannot be read, or the approval request cannot be sent (for example, end-to-end encryption is on but its key is missing). The extension waits up to 300 seconds for an answer to an approval request, whatever the configured timeout is: the configured timeout is the approval countdown, which Agent Approve itself ends (4 minutes at most).

  • deny: the tool call is blocked.
  • allow: the tool call runs.
  • ask: the tool call runs. Pi has no approval prompt of its own at this point, so the extension steps aside.

A deny decision from Agent Approve blocks the tool call; any other answer lets it run. An expired or invalid token, or an ended subscription, blocks tool calls until it is fixed.

When Agent Approve is temporarily busy it answers with a temporary refusal instead of a decision. The extension retries the same request on its own for a short time (at most 30 seconds). If the service is still busy, the tool call is blocked with an instruction to retry it. AGENTAPPROVE_FAIL_BEHAVIOR does not apply to a temporary refusal: a busy service never runs the tool.

Environment variables

The variables above set in the process environment take precedence over ~/.agentapprove/env, as do AGENTAPPROVE_TIMEOUT and AGENTAPPROVE_E2E_ENABLED.

Settings you change in the Agent Approve app are written to ~/.agentapprove/env by the extension (config sync). A sync never writes the token or the API URL. While end-to-end encryption is on and its key is missing or is not 64 hex characters, approval content is withheld and the fail behavior above applies; it is never sent unencrypted. Turning encryption off in the app is your setting: the next sync applies it, writes it to the file, and approvals are sent again. Running npx agentapprove restores the key.

Security

Requests are signed with Agent Approve HMAC headers and include the SHA256 hash of the installed package bundle. The API allowlists published bundle hashes by hook version.