security best-practices compliance

Paperclip Security Best Practices (2026): API Keys, Prompt Injection & Compliance

April 29, 2026 · HostAgentes Team · 5 min read

AI agents handle sensitive data, take actions on behalf of users, and talk to external services. Security is not optional — it is foundational. Here is how to secure your Paperclip agents in production.

Key Takeaway: Securing Paperclip agents comes down to three essentials: rotate API keys every 60–90 days, validate and sanitize every user input to prevent prompt injection, and enable audit logging on every agent decision — especially when handling sensitive data or operating under SOC 2, GDPR, or HIPAA requirements.

Threat Model

Paperclip agents face three main threat categories:

  1. Prompt injection — malicious input designed to override agent behavior
  2. Credential exposure — API keys and secrets leaking through logs or responses
  3. Data leakage — sensitive information exposed to unauthorized parties

Let’s address each one.

Prompt Injection Defense

Prompt injection is the top security concern for AI agents. A user crafts an input designed to make the agent ignore its instructions and perform unintended actions.

Input Sanitization

  • Validate inputs — reject or escape special characters that could be interpreted as instructions
  • Cap input length — limit user messages to a reasonable size (e.g. 10,000 characters)
  • Separate instructions from data — use clear delimiters between system instructions and user input

Principle of Least Privilege

  • Give agents access only to the tools they actually need
  • Restrict tool permissions (read-only where possible)
  • Use separate agents for sensitive operations
  • Never give an agent more access than the user making the request has

Output Filtering

  • Scan agent outputs for sensitive information before returning them to users
  • Filter credentials, API keys, and internal URLs out of responses
  • Log outputs for security audit trails

API Key & Secret Management

Use Environment Variables

Never embed secrets in agent configuration or prompts:

# Bad
"Your database connection string is postgresql://user:pass@db.internal:5432"

# Good
"Connect to the database using the DATABASE_URL environment variable"

On HostAgentes, environment variables are encrypted at rest and never exposed in logs or API responses.

Key Rotation

Rotate API keys on a schedule:

  • LLM provider keys — every 90 days
  • Database credentials — every 90 days
  • Agent API keys — every 60 days
  • Webhook secrets — every 90 days

Key Scope

Create separate API keys for:

  • Each application that calls your agent
  • Development versus production environments
  • Read-only versus read-write operations

Revoke keys immediately when they are no longer needed.

Data Handling

Data Classification

Classify the data your agent touches:

LevelExamplesHandling
PublicProduct info, documentationStandard
InternalTeam processes, metricsEncrypted at rest
SensitiveUser emails, preferencesEncrypted + access logging
CriticalPayment info, government IDsEncrypted + audit trails + DLP

Data Retention

Define retention policies:

  • Conversation logs — 90 days by default
  • Memory (vectors) — until explicitly deleted
  • Tool call logs — 90 days by default
  • Audit logs — 1 year minimum

Data Residency

For compliance (GDPR and similar regimes), deploy agents in the right region:

  • EU data → EU regions
  • US data → US regions
  • HostAgentes supports multi-region deployment

Network Security

TLS Everywhere

All communication with your agent goes over HTTPS/TLS. On HostAgentes this is automatic — SSL certificates are provisioned and renewed for you.

The API gateway also provides built-in rate limits, IP allowlists, and request authentication to protect your agent endpoints.

IP Allowlisting

Restrict which IP addresses can call your agent’s API endpoint. Configure it in the dashboard under Agent Settings → Security.

Rate Limits

Protect against abuse with rate limits:

  • Per-key request limits
  • Per-IP request limits
  • Daily token usage caps
  • Automatic blocking of abusive patterns

Compliance Considerations

SOC 2

To meet SOC 2, you need:

  • Audit logging of every agent decision
  • Data encrypted at rest and in transit
  • Access controls and key management
  • Documented incident response procedures

GDPR

For GDPR compliance:

  • Deploy in EU regions
  • Implement data deletion capabilities
  • Provide data export on request
  • Maintain processing records

HIPAA

For healthcare data:

  • Business Associate Agreement (BAA) with the hosting provider
  • Strong encryption standards
  • Access controls and audit logging
  • Breach notification procedures

Security Checklist

  • All secrets stored as environment variables (never in config)
  • API keys rotated on schedule
  • Input validation enabled
  • Output filtering configured
  • Rate limits active
  • Agent uses tools with least privilege
  • Data retention policies defined
  • Agent deployed in the correct region
  • Audit logging enabled
  • Monitoring alerts configured for security events

Security on HostAgentes

HostAgentes handles most of the security infrastructure for you:

  • Automatic SSL/TLS for every endpoint
  • Environment variables encrypted at rest
  • Built-in rate limits
  • Audit logging on all requests
  • Multi-region deployment for data residency
  • Automatic security patching

Every pricing plan includes these security features — even the Starter plan at $15/month.

Deploy secure agents →

H

HostAgentes Team

Engineering & product

The HostAgentes team is part of ZUI TECHNOLOGY, S.L. — we build managed hosting for AI agents and write about the infrastructure, models and patterns we use ourselves.

About us →

Ready to deploy your agents?

Managed hosting from $9.99/mo. Zero headaches.

View plans