a2aprovider

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package a2aprovider exposes agents over the Agent2Agent (A2A) protocol, adapting A2A messages to and from the framework message model and including server and hosting support.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAgent

func NewAgent(aclient *a2aclient.Client, config AgentConfig) *agent.Agent

NewAgent creates a new agent.Agent that delegates runs to a remote agent over the A2A (Agent-to-Agent) protocol via the a2a client. It panics if aclient is nil.

func NewExecutor

func NewExecutor(hostedAgent *agent.Agent, cfg ExecutorConfig) a2asrv.AgentExecutor

NewExecutor creates a new a2asrv.AgentExecutor using the provided configuration.

Use the returned executor with a2asrv.NewHandler, then wrap that request handler with a2asrv.NewJSONRPCHandler or a2asrv.NewRESTHandler for the HTTP binding you want to expose.

func TaskIDFromSession

func TaskIDFromSession(session *agent.Session) string

TaskIDFromSession returns the current A2A task ID stored in session state.

func WithMetadata

func WithMetadata(metadata map[string]any) agent.Option

WithMetadata sets A2A request-level metadata for a run. When hosting an agent, the executor supplies incoming request metadata through this option.

func WithTaskID

func WithTaskID(taskID string) agent.Option

WithTaskID sets the existing A2A task to resume when creating a session. Supply it to agent.Agent.CreateSession together with a nonblank agent.WithServiceID context ID.

Types

type AgentConfig

type AgentConfig struct {
	agent.Config
}

AgentConfig contains configuration for NewAgent.

type ExecutorConfig

type ExecutorConfig struct {
	// Whether the executor should allow background responses from the agent.
	AllowBackgroundResponses bool

	// AllowBackgroundResponsesWhen is a callback that determines on a per-message basis whether background responses should be allowed.
	// If both AllowBackgroundResponses and AllowBackgroundResponsesWhen are set, the callback takes precedence.
	AllowBackgroundResponsesWhen func(context.Context, *a2asrv.ExecutorContext) (bool, error)
}

ExecutorConfig defines the configuration for NewExecutor.

Jump to

Keyboard shortcuts

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