remoteagent

package
v1.17.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 31, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package remoteagent provides remote A2A agent support.

Remote agents allow communication with agents running in different processes or on different hosts using the A2A (Agent-to-Agent) protocol.

Basic Usage

Create a remote agent from a URL:

agent, _ := remoteagent.NewA2A(remoteagent.Config{
    Name:        "remote_helper",
    Description: "A remote helper agent",
    URL:         "http://localhost:9000",
})

With Agent Card

Provide an agent card directly:

agent, _ := remoteagent.NewA2A(remoteagent.Config{
    Name:        "remote_helper",
    Description: "A remote helper agent",
    AgentCard:   &a2a.AgentCard{...},
})

As Sub-Agent

Remote agents can be used as sub-agents:

parent, _ := llmagent.New(llmagent.Config{
    Name:      "orchestrator",
    SubAgents: []agent.Agent{remoteAgent},
})

As Tool

Remote agents can be wrapped as tools:

tool := agenttool.New(remoteAgent, nil)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewA2A

func NewA2A(cfg Config) (agent.Agent, error)

NewA2A creates a remote A2A agent.

Remote A2A agents communicate with agents running in different processes or on different hosts using the A2A (Agent-to-Agent) protocol.

The remote agent can be:

  • Used as a sub-agent for transfer patterns
  • Wrapped as a tool using agenttool.New()
  • Part of workflow agents (sequential, parallel, loop)

Example:

// From URL (agent card resolved automatically)
agent, _ := remoteagent.NewA2A(remoteagent.Config{
    Name:        "remote_helper",
    Description: "A remote helper agent",
    URL:         "http://localhost:9000",
})

// From explicit agent card source
agent, _ := remoteagent.NewA2A(remoteagent.Config{
    Name:            "remote_helper",
    Description:     "A remote helper agent",
    AgentCardSource: "http://localhost:9000/.well-known/agent-card.json",
})

Types

type Config

type Config struct {
	// Name is the local name for this remote agent.
	// Required.
	Name string

	// DisplayName is the human-readable name (optional).
	DisplayName string

	// Description describes what this remote agent does.
	Description string

	// URL is the base URL of the remote A2A server.
	// Can be used instead of AgentCard/AgentCardSource.
	// Example: "http://localhost:9000"
	URL string

	// AgentCard provides the agent card directly.
	// Takes precedence over URL and AgentCardSource.
	AgentCard *a2a.AgentCard

	// AgentCardSource is a URL or file path to resolve the agent card.
	// Used if AgentCard is not provided.
	// Example: "http://localhost:9000/.well-known/agent-card.json" or "./agent-card.json"
	AgentCardSource string

	// Headers are custom HTTP headers to include in requests.
	Headers map[string]string

	// Timeout is the request timeout. Default: 5m.
	Timeout time.Duration

	// Streaming controls whether to use SSE streaming (message/stream) or
	// blocking mode (message/send). Default: true (streaming enabled).
	Streaming bool

	// MessageSendConfig is attached to every message sent to the remote agent.
	MessageSendConfig *a2a.MessageSendConfig
}

Config configures a remote A2A agent.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL