server

package
v0.0.1-alpha.15 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterHandlers

func RegisterHandlers(ctx context.Context, registrar transport.HandlerRegistrar, config *Config) error

Types

type A2AServer

type A2AServer struct {
	// contains filtered or unexported fields
}

A2AServer represents an A2A server instance

type AgentCardConfig

type AgentCardConfig struct {
	Name             string
	Description      string
	URL              string
	Version          string
	DocumentationURL string

	Provider *models.AgentProvider

	SecuritySchemes    map[string]*spec.SecurityScheme
	Security           []map[string][]string
	DefaultInputModes  []string
	DefaultOutputModes []string
	Skills             []models.AgentSkill
}

type CancelTaskHandler

type CancelTaskHandler func(ctx context.Context, params *InputParams) (*models.TaskContent, error)

type Config

type Config struct {
	AgentCardConfig

	// optional
	MessageHandler MessageHandler
	// optional
	MessageStreamingHandler MessageStreamingHandler

	// optional, uuid by default
	TaskIDGenerator    func(ctx context.Context) (string, error)
	ContextIDGenerator func(ctx context.Context) (string, error)
	// required
	CancelTaskHandler CancelTaskHandler
	// required
	TaskEventsConsolidator TaskEventsConsolidator
	// optional, log.Printf by default
	Logger Logger
	// optional, in-memory by default
	TaskStore TaskStore
	// optional, in-memory by default
	TaskLocker TaskLocker
	// optional, in-memory by default
	Queue EventQueue
	// optional, in-memory by default
	PushNotifier PushNotifier
}

type EventQueue

type EventQueue interface {
	Push(ctx context.Context, taskID string, event *models.SendMessageStreamingResponseUnion, taskErr error) error
	Pop(ctx context.Context, taskID string) (event *models.SendMessageStreamingResponseUnion, taskErr error, closed bool, err error)
	Close(ctx context.Context, taskID string) error
	Reset(ctx context.Context, taskID string) error
}

type InputParams

type InputParams struct {
	Task     *models.Task
	Input    *models.Message
	Metadata map[string]any
}

type Logger

type Logger func(ctx context.Context, format string, v ...any)

type MessageHandler

type MessageHandler func(ctx context.Context, params *InputParams) (*models.TaskContent, error)

type MessageStreamingHandler

type MessageStreamingHandler func(ctx context.Context, params *InputParams, writer ResponseEventWriter) error

type PushNotifier

type PushNotifier interface {
	Set(ctx context.Context, config *models.TaskPushNotificationConfig) error
	Get(ctx context.Context, taskID string) (models.PushNotificationConfig, bool, error)
	Delete(ctx context.Context, taskID string) error
	SendNotification(ctx context.Context, event *models.SendMessageStreamingResponseUnion) error
}

func NewInMemoryPushNotifier

func NewInMemoryPushNotifier() PushNotifier

type ResponseEventWriter

type ResponseEventWriter interface {
	Write(event models.ResponseEvent) error
}

type TaskEventsConsolidator

type TaskEventsConsolidator func(ctx context.Context, params *InputParams, events []models.ResponseEvent, handleErr error) *models.TaskContent

type TaskLocker

type TaskLocker interface {
	Lock(ctx context.Context, id string) error
	Unlock(ctx context.Context, id string) error
}

type TaskStore

type TaskStore interface {
	Get(ctx context.Context, id string) (*models.Task, bool, error)
	Save(ctx context.Context, task *models.Task) error
}

Jump to

Keyboard shortcuts

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