AgentGate Documentation

AgentGate is the open-source gateway to deploy, connect, and monetize AI agents. It implements the A2A (Agent-to-Agent) protocol for agent interoperability.

Quickstart

Get started in under 2 minutes:

# Install the CLI & SDK
pip install agentgatesh

# Check server status
agentgate status

# Deploy your first agent
agentgate deploy ./my-agent/

Installation

# Via pip
pip install agentgatesh

# Or via uv
uv pip install agentgatesh

The package provides both the agentgate CLI and the Python SDK (AgentGateClient, AsyncAgentGateClient).

Authentication

AgentGate supports two types of authentication:

Both use Bearer token authentication: Authorization: Bearer <key>

CLI: Deploy an Agent

Create an agentgate.yaml in your agent directory:

name: my-agent
description: My awesome AI agent
url: https://agentgate.sh/my-agent
version: 1.0.0
skills:
  - id: chat
    name: Chat
    description: General conversation

Then deploy:

agentgate deploy ./my-agent/ --api-key YOUR_KEY

CLI Commands

CommandDescription
agentgate statusCheck server health
agentgate list [--skill X]List deployed agents
agentgate deploy <path>Deploy agent from agentgate.yaml
agentgate update <id>Update agent fields
agentgate delete <id>Remove an agent
agentgate logs <id>View invocation logs
agentgate usage <id>View usage stats
agentgate billing <id>Usage breakdown by day/month
agentgate bump <part>Bump version (patch/minor/major)

API: Agents

POST /agents/

Register a new agent. Requires admin or org API key.

curl -X POST https://agentgate.sh/agents/ \
  -H "Authorization: Bearer YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "my-agent", "url": "https://example.com", "skills": []}'

GET /agents/

List all agents. Public, no auth required. Filter by skill: ?skill=echo

GET /agents/{id}

Get a single agent by UUID. Public.

PUT /agents/{id}

Update an agent. Admin key or org key (org-scoped).

DELETE /agents/{id}

Delete an agent. Admin key or org key (org-scoped).

GET /agents/{id}/card

Get the A2A-compliant Agent Card. Public.

GET /agents/{id}/logs

Get invocation logs. Admin or org key. Params: limit, offset.

GET /agents/{id}/usage

Get usage stats (invocations, errors, avg latency). Admin or org key.

GET /agents/{id}/usage/breakdown

Usage breakdown. Params: period=day|month, days=30. Admin or org key.

API: Task Routing

POST /agents/{id}/task

Route an A2A task to the agent. If the agent has per-agent auth, a Bearer token is required.

curl -X POST https://agentgate.sh/agents/AGENT_ID/task \
  -H "Content-Type: application/json" \
  -d '{"id": "task-1", "message": {"parts": [{"type": "text", "text": "Hello!"}]}}'

API: Organizations

POST /orgs/

Create an organization. Admin only.

curl -X POST https://agentgate.sh/orgs/ \
  -H "Authorization: Bearer ADMIN_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "acme-corp", "api_key": "org-secret-key", "cost_per_invocation": 0.002}'

GET /orgs/

List all organizations. Admin only.

GET /orgs/{id}

Get org details. Admin or org owner.

PUT /orgs/{id}

Update org settings (cost, rate limits, etc). Admin or org owner.

DELETE /orgs/{id}

Delete an organization. Admin only.

GET /orgs/{id}/agents

List agents in an organization. Admin or org owner.

API: Billing

GET /orgs/{id}/billing

Get billing summary: total invocations, costs, alert status. Admin or org owner.

GET /orgs/{id}/billing/breakdown

Daily billing breakdown for the last 30 days. Admin or org owner.

API: Health & Metrics

EndpointAuthDescription
GET /healthPublicServer health + version
GET /health/agentsPublicAll agents health status
GET /agents/{id}/healthPublicSingle agent health
GET /metricsAdminTask routing metrics
GET /.well-known/agent.jsonPublicA2A discovery

SDK: Sync Client

from agentgate import AgentGateClient

client = AgentGateClient("https://agentgate.sh", api_key="YOUR_KEY")

# List agents
agents = client.list_agents(skill="echo")

# Send a task
result = client.send_task("agent-id", "Hello!")

# Get usage
usage = client.get_agent_usage("agent-id")

# Organization management
orgs = client.list_orgs()
org = client.create_org("acme", api_key="secret-key")
billing = client.get_org_billing(str(org["id"]))

client.close()

SDK: Async Client

from agentgate import AsyncAgentGateClient

async with AsyncAgentGateClient("https://agentgate.sh", api_key="KEY") as client:
    agents = await client.list_agents()
    result = await client.send_task("agent-id", "Hello!")
    billing = await client.get_org_billing("org-id")

SDK: Org Management

from agentgate import AgentGateClient

client = AgentGateClient("https://agentgate.sh", api_key="ADMIN_KEY")

# Create org with custom billing
org = client.create_org(
    "acme-corp",
    api_key="org-secret",
    cost_per_invocation=0.002,
    rate_limit=50.0,
    rate_burst=100,
)

# List orgs
orgs = client.list_orgs()

# Get org billing
billing = client.get_org_billing(str(org["id"]))
print(f"Total cost: ${billing['total_cost']}")

# Update org settings
client.update_org(str(org["id"]), rate_limit=100.0)

# Delete org
client.delete_org(str(org["id"]))

Org-Scoped Auth

Each organization has its own API key. When an org authenticates, it can only:

Admin key retains full access to everything.

Per-Agent Auth

Agents can optionally require a separate API key for task routing:

# Register agent with per-agent auth
client.register_agent(
    "my-agent", "https://example.com",
    agent_api_key="agent-secret-key",
)

# Send task with per-agent key
client.send_task("agent-id", "Hello!", agent_api_key="agent-secret-key")

Rate Limiting

Task routing is rate-limited using a token bucket algorithm:

Webhooks

Agents can have a webhook_url — a fire-and-forget POST is sent after each task completion:

{
  "event": "task.completed",
  "agent_id": "uuid",
  "agent_name": "my-agent",
  "task_id": "task-1",
  "latency_ms": 42.5
}

Agent Chaining

Agents can call other agents through AgentGate routing, enabling complex multi-agent workflows:

# Inside your agent, call another agent via AgentGate
import httpx

response = httpx.post(
    "https://agentgate.sh/agents/CALC_AGENT_ID/task",
    json={"id": "sub-1", "message": {"parts": [{"type": "text", "text": "5 + 3"}]}}
)
result = response.json()

Pricing & Tiers

AgentGate supports three organization tiers with different limits and platform fees:

FeatureFreeProEnterprise
Max Agents550500
Rate Limit10 req/s100 req/s1,000 req/s
Platform Fee3%2.5%2%

Agents can set a price_per_task when registering. When a task is routed to a paid agent, the caller's org balance is automatically charged.

POST /orgs/{id}/tier

Change an organization's tier. Admin or org owner.

curl -X POST https://agentgate.sh/orgs/ORG_ID/tier \
  -H "Authorization: Bearer KEY" \
  -H "Content-Type: application/json" \
  -d '{"tier": "pro"}'

Wallet & Topup

Each organization has a wallet balance. Funds must be added before using paid agents.

GET /orgs/{id}/wallet

Get wallet balance, tier info, and agent count. Admin or org owner.

POST /orgs/{id}/topup

Add funds to an organization's wallet.

curl -X POST https://agentgate.sh/orgs/ORG_ID/topup \
  -H "Authorization: Bearer KEY" \
  -H "Content-Type: application/json" \
  -d '{"amount": 100.0}'

Transactions

Every paid task creates a transaction record in the ledger.

GET /orgs/{id}/transactions

List transactions. Filter by role=payer|receiver|all. Supports limit and offset.

GET /orgs/{id}/transactions/summary

Get aggregated totals: spent, earned, fees, transaction counts.

Billing Flow

When a task is routed to a paid agent:

  1. Balance check — If the caller org has insufficient balance, returns HTTP 402.
  2. Task execution — The task is forwarded to the agent via A2A protocol.
  3. Charge — On success, the payer org is charged price_per_task.
  4. Credit — The agent owner org receives the amount minus the platform fee.
  5. Ledger — A transaction record is created with amount, fee, and net.

If the agent is unreachable or returns an error, no charge is made.

SDK: Wallet & Transactions

from agentgate import AgentGateClient

client = AgentGateClient("https://agentgate.sh", api_key="KEY")

# Check wallet
wallet = client.get_org_wallet("org-id")
print(f"Balance: ${wallet['balance']}")

# Add funds
client.topup_org("org-id", amount=50.0)

# List transactions
txns = client.list_org_transactions("org-id", role="payer")

# Transaction summary
summary = client.get_org_transaction_summary("org-id")
print(f"Spent: ${summary['total_spent']}")

# Change tier
client.change_org_tier("org-id", "pro")

UCP Discovery

AgentGate implements the Universal Commerce Protocol (UCP) by Google + Shopify for agentic commerce. The UCP profile is available at:

GET /.well-known/ucp

Returns the UCP discovery profile with supported services, capabilities, and payment methods.

curl https://agentgate.sh/.well-known/ucp

Response includes dev.ucp.shopping service with checkout and catalog capabilities.

UCP Catalog

Browse paid agents as UCP products.

GET /ucp/catalog

curl https://agentgate.sh/ucp/catalog

Returns a list of paid agents with their prices, descriptions, and tags in UCP product format.

UCP Checkout

UCP checkout sessions provide a standard commerce flow for paid agent tasks.

POST /ucp/checkout

Create a checkout session for a paid agent task.

curl -X POST https://agentgate.sh/ucp/checkout \
  -H "Authorization: Bearer ORG_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "agent_id": "AGENT_ID",
    "task": {"id": "t1", "message": {"parts": [{"type": "text", "text": "hello"}]}}
  }'

GET /ucp/checkout/{session_id}

Get the status of a checkout session.

POST /ucp/checkout/{session_id}/complete

Complete the checkout: executes the A2A task, processes billing, and returns the result.

The checkout flow: Create session (pre-check balance) → Complete (task + billing) → Result (with transaction ID).

Paid agent cards also include UCP capability metadata, making them discoverable by UCP-compatible agents.

AgentGate is open source. GitHub | Home | Dashboard | Admin | Swagger API