Concepts

An agent is the core unit in Regent SDK. It represents an autonomous service with typed capabilities (entrypoints), optional payments, and discoverable metadata.

Creating an Agent

High-Level API

Use createRegentAgent() for the simplest setup:

import { createRegentAgent } from 'regent-sdk';

const agent = await createRegentAgent({
  name: 'my-agent',
  version: '1.0.0',
  description: 'An AI-powered assistant',
  http: { port: 3000 },
});

Low-Level API

Use createAgent() with the extension pattern for full control:

import { createAgent } from '@regent/core';
import { http } from '@regent/http';

const agent = await createAgent({
  name: 'my-agent',
  version: '1.0.0',
  description: 'An AI-powered assistant',
})
  .use(http())
  .build();

The createAgent() function returns an AgentBuilder that lets you compose extensions before calling .build().

Agent Metadata

The AgentMeta type describes your agent for discovery and display:

Example with Full Metadata

This metadata is used to:

  • Generate the Agent Card (/.well-known/agent.json) for A2A discovery

  • Render Open Graph tags for social sharing

  • Display information on the landing page (if enabled)

The Extension System

Agents are built by composing extensions. Each extension adds capabilities:

Available Extensions

Extension
Package
Purpose

http()

@regent/http

HTTP request/response handling, SSE streaming

wallets()

@regent/wallet

Wallet management for agent operations

payments()

@regent/x402

x402 payment protocol

a2a()

@regent/a2a

Agent-to-Agent communication

ap2()

@regent/ap2

Agent Payments Protocol

Extensions are independent and can be used in any combination.

Extension Interface

Extensions follow a consistent interface:

Lifecycle Hooks:

Hook
When Called
Purpose

build

During .build()

Initialize extension, return runtime context

onEntrypointAdded

After addEntrypoint()

React to new entrypoints

onBuild

After all extensions built

Final setup (can be async)

onManifestBuild

When building Agent Card

Enhance manifest with extension data

Conflict Detection

The builder automatically detects when two extensions add the same property:

AgentBuilder

The AgentBuilder provides a fluent API:

Adding Entrypoints via Builder

AgentRuntime

The built agent runtime provides access to all configured capabilities:

AgentCore

The core agent manages entrypoints:

Framework Adapters

After building an agent, use an adapter to expose it via your preferred framework:

Hono

Express

TanStack Start

Agent Card

Every agent automatically generates an Agent Card at /.well-known/agent.json. This follows the A2A protocol and includes:

  • Agent metadata (name, version, description)

  • Supported interfaces and capabilities

  • Available skills (entrypoints)

  • Payment methods (if configured)

  • Identity registrations (if configured)

Example Agent Card:

HTTP Endpoints

When using the http() extension and a framework adapter, your agent exposes:

Endpoint
Method
Purpose

/.well-known/agent.json

GET

Agent Card for A2A discovery

/entrypoints

GET

List available entrypoints

/entrypoints/:key/invoke

POST

Invoke an entrypoint

/entrypoints/:key/stream

POST

Stream from an entrypoint (SSE)

/tasks

POST

Create a new task

/tasks

GET

List tasks

/tasks/:id

GET

Get task status

/tasks/:id/cancel

POST

Cancel a task

/tasks/:id/subscribe

GET

Subscribe to task updates (SSE)

/health

GET

Health check

Next Steps

Last updated