Skip to main content

Getting Started with PAP Agents

This guide will walk you through creating and managing your first PAP agent using the Plugged.in API.

Prerequisites

Before you begin, ensure you have:
An active Plugged.in account with a project and profile configured
An API key generated from your Plugged.in dashboard
Access to the PAP agent infrastructure (currently in early access)
Don’t have an API key? Navigate to your project settings in Plugged.in and create a new API key under “API Keys & Authentication”. Save it securely—it won’t be shown again!

Quick Start: Deploy Your First Agent

Step 1: Set Up Your Environment

Save your API key as an environment variable:

Step 2: Create an Agent

Use the Plugged.in API to create your first agent:
Agent names must be DNS-safe: lowercase letters, numbers, and hyphens only. They’ll become part of your agent’s URL: {name}.is.plugged.in

Step 3: Wait for Provisioning

The API returns immediately with the agent record and deployment status:
The agent transitions through states automatically:
  1. NEW → Agent created in database
  2. PROVISIONED → Kubernetes deployment created
  3. ACTIVE → Agent is running and healthy (after first heartbeat)

Step 4: Verify Your Agent

Check your agent’s status:
Or access it directly via HTTPS:
Success! If you see a response, your agent is live with automatic Let’s Encrypt TLS certificate.

Understanding Agent Configuration

Basic Configuration

When creating an agent, you can specify:

Resource Recommendations

Light Agent

CPU: 100m request, 500m limit
Memory: 128Mi request, 512Mi limit
For simple monitoring or webhook agents

Standard Agent

CPU: 250m request, 1000m limit
Memory: 256Mi request, 1Gi limit
Recommended for most use cases

Heavy Agent

CPU: 500m request, 2000m limit
Memory: 512Mi request, 2Gi limit
For complex workflows or ML inference
Resource Quotas: The agents namespace has limits (40 CPU, 200Gi memory, 100 pods max). Contact support if you need higher limits.

Managing Your Agents

List All Agents

Retrieve all agents in your active profile:
Response:

Get Agent Details

View comprehensive agent information including heartbeats, metrics, and lifecycle events:
Response includes:
  • Agent metadata and current state
  • Recent heartbeats (last 10)
  • Recent metrics (last 10)
  • Complete lifecycle event history
  • Real-time Kubernetes deployment status

Terminate an Agent

When you’re done with an agent, terminate it to free resources:
Graceful Shutdown: Agents support graceful draining. In the future, you’ll be able to set agents to DRAINING state to complete in-flight work before termination.

Agent Lifecycle States

Understanding agent states is crucial for management:
KILLED vs TERMINATED: Only the Station (control plane) can KILL an agent. User-initiated deletion results in TERMINATED state. KILLED indicates a control-plane decision (e.g., policy violation, zombie detection).

Monitoring Your Agents

Heartbeats (Liveness)

PAP agents send heartbeats to signal liveness:
  • EMERGENCY mode: Every 5 seconds (for critical situations)
  • IDLE mode: Every 30 seconds (default)
  • SLEEP mode: Every 15 minutes (for low-priority background agents)
Zombie Detection: Missing one heartbeat interval triggers AGENT_UNHEALTHY (error code 480). This aggressive detection is possible because heartbeats contain NO resource data—only mode and uptime.

Metrics (Resource Telemetry)

Separate from heartbeats, agents emit metrics approximately every 60 seconds:
  • CPU usage percentage
  • Memory usage in MB
  • Requests handled count
  • Custom metrics (agent-specific)
View recent metrics:

Logs

Retrieve agent logs for debugging:
For now, server administrators can access logs via kubectl:

Common Patterns

1. Deploy a Monitoring Agent

2. Deploy a Research Assistant

3. Deploy a Scheduled Report Generator

Troubleshooting

Agent Stuck in NEW State

Problem: Agent never transitions to PROVISIONED. Solution: Check deployment status:
Common causes:
  • Image pull failure (if using custom image)
  • Resource quota exceeded
  • Invalid container configuration

Agent Stuck in PROVISIONED State

Problem: Agent doesn’t transition to ACTIVE. Solution: Agent hasn’t sent its first heartbeat. Check pod logs:
Common causes:
  • Application not starting
  • Heartbeat endpoint misconfigured
  • Network connectivity issues

No HTTPS Access

Problem: Cannot access https://{agent}.is.plugged.in Solution: Check certificate status:
Common causes:
  • Certificate still provisioning (wait 1-2 minutes)
  • DNS not propagated
  • cert-manager issue
DNS Propagation: New agents may take 30-60 seconds for DNS to propagate globally. Test locally first: curl https://{agent}.is.plugged.in --resolve {agent}.is.plugged.in:443:185.96.168.254

Next Steps

Now that you’ve deployed your first agent:

Explore Architecture

Understand PAP’s dual-profile design and protocol details

API Reference

Complete API documentation with all endpoints and parameters

Lifecycle Deep Dive

Master agent state management and transitions

Monitoring Guide

Set up comprehensive observability for your agents

Need Help?

Join Discord

Get help from the community and Plugged.in team

GitHub Issues

Report bugs or request features