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:Step 3: Wait for Provisioning
The API returns immediately with the agent record and deployment status:- NEW → Agent created in database
- PROVISIONED → Kubernetes deployment created
- ACTIVE → Agent is running and healthy (after first heartbeat)
Step 4: Verify Your Agent
Check your agent’s status: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
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
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
Memory: 512Mi request, 2Gi limit
For complex workflows or ML inference
Managing Your Agents
List All Agents
Retrieve all agents in your active profile:Get Agent Details
View comprehensive agent information including heartbeats, metrics, and lifecycle events:- 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:| State | Description | Typical Duration |
|---|---|---|
| NEW | Created in database, awaiting provisioning | < 1 second |
| PROVISIONED | Kubernetes resources deployed, waiting for first heartbeat | 10-30 seconds |
| ACTIVE | Running and accepting requests | Indefinite |
| DRAINING | Gracefully shutting down, completing work | 30-120 seconds |
| TERMINATED | Cleanly shut down, resources released | Permanent |
| KILLED | Forcefully terminated by Station | Permanent |
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)
Logs
Retrieve agent logs for debugging: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:- 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:- Application not starting
- Heartbeat endpoint misconfigured
- Network connectivity issues
No HTTPS Access
Problem: Cannot accesshttps://{agent}.is.plugged.in
Solution: Check certificate status:
- Certificate still provisioning (wait 1-2 minutes)
- DNS not propagated
- cert-manager issue
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

