Ecosystem

OpenApe Proxy

Agent HTTP gateway with grant-based access control.

@openape/proxy

A forward proxy that sits between an agent and the internet, enforcing grant-based access rules before forwarding requests. All traffic is logged for audit purposes.

Installation

npm install -g @openape/proxy

Quick Start

# Start the proxy
openape-proxy --config config.toml

# Dry-run mode (evaluate rules without enforcing)
openape-proxy --config config.toml --dry-run

# Require all requests to have agent authentication
openape-proxy --config config.toml --mandatory-auth

Configuration

Create a config.toml file:

listen = "127.0.0.1:9090"
idp_url = "https://id.example.com"
agent_email = "bot@example.com"
default_action = "block"  # block | request | request-async
audit_log = "/var/log/openape-proxy/audit.jsonl"

# Allow GET requests to GitHub API
[[rules.allow]]
domains = ["api.github.com"]
methods = ["GET"]

# Require a grant for write operations
[[rules.grant_required]]
domains = ["api.github.com"]
methods = ["POST", "PUT", "DELETE"]
grant_type = "once"

# Block internal network access
[[rules.deny]]
domains = ["*.internal.corp"]

Configuration Fields

FieldRequiredDefaultDescription
listenYesBind address and port
idp_urlYesIdP URL for grant requests
agent_emailYesAgent identity email
default_actionNoblockAction for unmatched requests: block, request, request-async
audit_logNoPath for JSONL audit log

Default Actions

ActionBehavior
blockReject unmatched requests immediately
requestAuto-request a grant and wait for approval
request-asyncAuto-request a grant, reject the current request, retry on next attempt

Rule Evaluation

Rules are evaluated in this order:

  1. deny — If a deny rule matches, the request is blocked immediately
  2. allow — If an allow rule matches, the request is forwarded
  3. grant_required — If a grant rule matches, a grant must be approved before forwarding
  4. Default action — If no rule matches, the default_action is applied

Rule Fields

Each rule can match on:

FieldTypeDescriptionExample
domainsstring[]Domain patterns (supports * wildcard)["api.github.com", "*.aws.com"]
methodsstring[]HTTP methods["GET", "POST"]
pathsstring[]URL path patterns["/api/v1/*"]

For grant_required rules, additionally:

FieldTypeDescription
grant_typestringRequired grant type: once, timed, always

Multi-Agent Configuration

For proxies serving multiple agents:

[agents.deploy-bot]
idp_url = "https://id.example.com"
agent_email = "agent+deploy@example.com"

[agents.monitor-bot]
idp_url = "https://id.example.com"
agent_email = "agent+monitor@example.com"

# Agent-specific rules
[[agents.deploy-bot.rules.allow]]
domains = ["api.github.com"]
methods = ["GET", "POST"]

[[agents.monitor-bot.rules.allow]]
domains = ["api.datadog.com"]

Audit Logging

Every request is logged as JSONL:

{
  "timestamp": "2025-01-15T10:30:00Z",
  "agent": "agent+deploy@example.com",
  "method": "POST",
  "url": "https://api.github.com/repos/org/repo/releases",
  "rule": "grant_required",
  "grant_id": "abc123",
  "decision": "allowed",
  "status": 201,
  "duration_ms": 342
}

Common Patterns

Allow reads, require grants for writes

default_action = "block"

[[rules.allow]]
domains = ["api.github.com"]
methods = ["GET", "HEAD", "OPTIONS"]

[[rules.grant_required]]
domains = ["api.github.com"]
methods = ["POST", "PUT", "PATCH", "DELETE"]
grant_type = "once"

Block sensitive endpoints

[[rules.deny]]
domains = ["*.internal.corp", "metadata.google.internal"]

[[rules.deny]]
domains = ["*"]
paths = ["/admin/*", "/.env", "/secrets/*"]