Examples
Available Examples
Quick Examples
Minimal Agent
Agent with Payments
Agent with Identity
Environment Setup
Last updated
Last updated
import { createAgent } from '@regent/core';
import { http } from '@regent/http';
import { createAgentApp } from '@regent/hono';
import { z } from 'zod';
const agent = await createAgent({
name: 'minimal-agent',
version: '1.0.0',
})
.use(http())
.addEntrypoint({
key: 'echo',
input: z.object({ text: z.string() }),
handler: async ({ input }) => ({
output: { echoed: input.text },
}),
})
.build();
const { app } = await createAgentApp(agent);
Bun.serve({ fetch: app.fetch, port: 3000 });import { createAgent } from '@regent/core';
import { http } from '@regent/http';
import { payments, paymentsFromEnv } from '@regent/x402';
import { createAgentApp } from '@regent/hono';
const agent = await createAgent({
name: 'paid-agent',
version: '1.0.0',
})
.use(http())
.use(payments({ config: paymentsFromEnv() }))
.addEntrypoint({
key: 'premium',
price: '0.10',
handler: async ({ input }) => ({
output: { result: 'premium content' },
}),
})
.build();
const { app } = await createAgentApp(agent);import { createRegentAgent } from 'regent-sdk';
const agent = await createRegentAgent({
name: 'verified-agent',
description: 'Agent with on-chain identity',
version: '1.0.0',
identity: {
chainId: 84532,
rpcUrl: 'https://sepolia.base.org',
ipfs: 'pinata',
ipfsConfig: { pinataJwt: process.env.PINATA_JWT },
},
trust: { reputation: true },
});
const { agentId } = await agent.registerOnchain();
console.log('Registered:', agentId);# Wallet
AGENT_WALLET_PRIVATE_KEY=0x...
# Payments
PAYMENTS_RECEIVABLE_ADDRESS=0x...
FACILITATOR_URL=https://facilitator.example.com
NETWORK=base-sepolia
# Identity (for ERC-8004)
PINATA_JWT=your-jwt-token
# LLM (for AI examples)
OPENAI_API_KEY=sk-...