A2A

Examples of inter-agent communication using the A2A protocol.

Fetching Agent Cards

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

const agent = await createAgent({
  name: 'client-agent',
  version: '1.0.0',
})
  .use(http())
  .use(a2a())
  .build();

// Fetch another agent's card
const card = await agent.a2a.fetchCard('https://other-agent.example.com');
console.log('Agent:', card.name);
console.log('Skills:', card.skills?.map(s => s.id));

Direct Invocation

Streaming

Task-Based Communication

Subscribe to Task Updates

Wait for Task

Multi-Turn Conversation

Task Management

Check Agent Capabilities

Complete Example

Last updated