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 ¶
- func NewAgent(aclient *a2aclient.Client, config AgentConfig) *agent.Agent
- func NewExecutor(hostedAgent *agent.Agent, cfg ExecutorConfig) a2asrv.AgentExecutor
- func TaskIDFromSession(session *agent.Session) string
- func WithMetadata(metadata map[string]any) agent.Option
- func WithTaskID(taskID string) agent.Option
- type AgentConfig
- type ExecutorConfig
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 ¶
TaskIDFromSession returns the current A2A task ID stored in session state.
func WithMetadata ¶
WithMetadata sets A2A request-level metadata for a run. When hosting an agent, the executor supplies incoming request metadata through this option.
func WithTaskID ¶
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 ¶
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.