Skip to main content

Your First Agent

This tutorial walks through the core setup flow: creating a tenant, registering an agent, and making it accessible — either programmatically via a channel or interactively via a user subscription.
Prerequisites — You need a running A2A-compliant agent with a publicly accessible agent card URL. If you don’t have one yet, see the Google A2A specification for how to build one.

Step 1: Create a Tenant

A tenant is your organisation on Swarmd. Creating one also creates your first admin user.

Step 2: Verify Your Email

Check your inbox for a verification email and extract the token.
Didn’t receive the email? Resend it:

Step 3: Log In

Response:
Save the accessToken — you’ll use it as a Bearer token for all subsequent requests.
Access tokens expire. Use the refresh endpoint to obtain a new one:
For the remaining API examples, set your token as an environment variable:

Step 4: Register Your Agent

Registration tells Swarmd where your agent lives and what it can do. Swarmd fetches your agent card to read its capabilities, name, and description.
Response:
All three values are shown once. The platform cannot retrieve them later — store them with your agent’s deployment configuration at registration time. Losing them means deregistering and re-registering the agent to rotate.
Note: there is no webhookUrl field. SwarmD derives your agent’s webhook endpoint from agentCardUrl by stripping the /.well-known/agent-card.json suffix and appending /admin/webhook. If you use the SDK’s create_admin_app(...) mounted at /admin, this works automatically.
If you provide a healthCheckUrl, Swarmd will monitor your agent’s health and display its status as Healthy, Degraded, or Unhealthy in the dashboard.

Step 5: Set Up Access

There are three ways to give callers access to your agent: A channel is a first-class integration entity that gives an external system its own OAuth2 service account to invoke agents.

1. Create the channel

Response:
The clientSecret is only returned once at creation time. Store it securely — you cannot retrieve it later.

2. Subscribe the channel to your agent

Response:

3. List agents available to the channel

Returns a list of all agents this channel is subscribed to, including each agent’s sinkAgentId and sinkAgentName.

Option B: Subscribe a User

This lets you (as a human) send messages to the agent from the dashboard or via the Human Relay API.

Option C: Subscribe Agent-to-Agent

If you have a second agent that needs to call the first:

Authentication Options (User & Agent Subscriptions)

The authConfig tells the relay how to authenticate with the target agent when forwarding messages. This applies to user and agent subscriptions — channels don’t need an authConfig because they authenticate to Swarmd itself via their service account.
If you skip authConfig or use NONE but the target agent actually requires authentication, the subscription will be created but messages will fail when relayed.

Step 6: Send Your First Message

The endpoint you use depends on how you set up access.

Via Channel

Channels use OAuth2 client credentials to authenticate. First, exchange your clientId and clientSecret for an access token, then call the channel relay endpoint.

1. Get an access token

Response:

2. Send a message

Via User Session

Users authenticate with email/password login and use the human relay endpoint.

Response

Both endpoints return the same A2A JSON-RPC response:
If the task is working, poll for the result:
Poll every 5 seconds until you receive a terminal state (completed, failed, or canceled).

Step 7: Verify in the Audit Log

Every message through the relay is automatically logged.
To see the full trace of a specific request:

Endpoint Reference


Next Steps

TypeScript Channel Client

Connect a website to this channel with OAuth, conversation continuity, polling, and typed lifecycle events.

Policy Configuration

Add guardrails to control what your agents can send and receive.