Skip to main content

PAP Agents API Reference

This document provides comprehensive API documentation for creating and managing PAP agents.

Base URL

Authentication

All endpoints require API key authentication via the Authorization header:
API Keys: Generate API keys from your Plugged.in project settings. Keys are scoped to profiles within projects.

Endpoints

List Agents

Retrieve all agents for the authenticated user’s active profile.

Response

Response Fields


Create Agent

Deploy a new PAP agent to Kubernetes infrastructure.

Request Body

DNS-Safe Names: Agent names must match the pattern ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$. Invalid names will return HTTP 400.

Response (Success)

Error Responses


Get Agent Details

Retrieve comprehensive information about a specific agent, including recent heartbeats, metrics, and lifecycle events.

Response

Response Fields

Error Responses


Delete Agent

Terminate and delete an agent, removing all Kubernetes resources.

Response (Success)

State Transition: User-initiated deletion transitions agent to TERMINATED state. Only the Station (control plane) can issue KILLED state.

Cleanup Operations

The DELETE operation removes:
  • Kubernetes Deployment
  • Kubernetes Service
  • Kubernetes Ingress
  • TLS Secret (Let’s Encrypt certificate)
The agent record remains in database with state=TERMINATED for audit purposes.

Error Responses


Export Agent Data

Export complete agent data including telemetry history for backup or analysis.

Request Body

Response

Returns complete agent data including configuration, lifecycle events, and telemetry:

Submit Heartbeat

Agents send heartbeats to signal liveness. Heartbeats contain ONLY liveness data (zombie prevention).
CRITICAL: Heartbeats must contain ONLY mode and uptime_seconds. Never include resource data (CPU, memory) in heartbeats—use the Metrics endpoint instead. This separation is the core of PAP’s zombie prevention.

Request Body

Heartbeat Intervals:
  • EMERGENCY: Every 5 seconds (for critical situations)
  • IDLE: Every 30 seconds (default)
  • SLEEP: Every 15 minutes (for low-priority background agents)
Missing one interval triggers AGENT_UNHEALTHY (error code 480).

Response


Submit Metrics

Agents send metrics separately from heartbeats. Metrics contain resource telemetry only.
Separation is Key: Metrics are sent on a separate channel from heartbeats (typically every 60 seconds). This ensures large telemetry payloads cannot starve the control path.

Request Body

Response


Common Patterns

Create and Wait for Activation

List Healthy Agents

Bulk Termination


Rate Limits

API endpoints are subject to rate limits to ensure fair usage: Rate limit headers:
429 Too Many Requests: If you exceed rate limits, wait for the reset time indicated in X-RateLimit-Reset header.

Webhook Events (Coming Soon)

Subscribe to agent lifecycle events via webhooks:
Available Events:
  • agent.created
  • agent.provisioned
  • agent.activated
  • agent.draining
  • agent.terminated
  • agent.killed
  • agent.unhealthy

SDK Support

Official Plugged.in SDKs now include agent management:

TypeScript/Node.js

Access via client.agents

Python

Access via client.agents

Go

Access via client.Agents

SDK Examples


Next Steps

Lifecycle Management

Understand agent states and transitions

Monitoring Guide

Set up observability for your agents