Overview of Agents API
The Agents API (payments.agents) enables you to:
- Register AI agents with metadata and API endpoints
- Associate agents with one or more payment plans
- Register agents and plans together in a single operation
- Update agent metadata and configuration
- Retrieve agent information
- Manage plan associations (add/remove plans from agents)
Agent Metadata Structure
Agents require metadata for discovery and identification:Agent API Configuration
Define how your agent’s API endpoints can be accessed:Endpoint Patterns
You can use path parameters in your endpoint definitions:Register Agents
Register Agent with Existing Plans
If you’ve already registered payment plans, you can register an agent and associate it with those plans:Register Agent and Plan Together
For convenience, you can register both an agent and its payment plan in a single operation:Retrieve Agents
Get a Specific Agent
Get Plans for an Agent
Update Agent Metadata
You can update agent metadata and API configuration after registration:Manage Agent Plans
Add Plans to an Agent
Associate additional payment plans with an existing agent:Remove Plans from an Agent
Remove payment plan associations:Authentication Types
The Agents API supports multiple authentication types:Complete Example: Multi-Endpoint Agent
Best Practices
- Descriptive Metadata: Use clear names and descriptions for better discoverability
- Relevant Tags: Add tags that help users find your agent
- RESTful Endpoints: Follow REST conventions for endpoint paths
- OpenAPI Specs: Provide agent definition URLs for better integration
- Multiple Plans: Offer different pricing tiers for various use cases
- Bearer Auth: Use bearer token authentication for secure access
Related Documentation
- Payment Plans - Create plans to associate with agents
- Publishing Static Resources - Register static content agents
- Validation of Requests - Validate incoming agent requests
Source References:
src/api/agents-api.ts(Agents API methods)tests/e2e/test_payments_e2e.test.ts(lines 373-449)tests/e2e/test_x402_e2e.test.ts(agent registration examples)