Documentation
¶
Overview ¶
Package a2a provides the A2A task store and executor for the SDK.
Index ¶
- Variables
- func NewExecutor() *rta2a.Executor
- type InMemoryTaskStore
- func (s *InMemoryTaskStore) AddArtifacts(taskID string, artifacts []rta2a.Artifact) error
- func (s *InMemoryTaskStore) Cancel(taskID string) error
- func (s *InMemoryTaskStore) Create(taskID, contextID string) (*rta2a.Task, error)
- func (s *InMemoryTaskStore) EvictTerminal(cutoff time.Time) []string
- func (s *InMemoryTaskStore) Get(taskID string) (*rta2a.Task, error)
- func (s *InMemoryTaskStore) List(contextID string, limit, offset int) ([]*rta2a.Task, error)
- func (s *InMemoryTaskStore) SetState(taskID string, state rta2a.TaskState, msg *rta2a.Message) error
- type TaskStore
Constants ¶
This section is empty.
Variables ¶
var ( ErrTaskNotFound = errors.New("a2a: task not found") ErrTaskAlreadyExists = errors.New("a2a: task already exists") ErrInvalidTransition = errors.New("a2a: invalid state transition") ErrTaskTerminal = errors.New("a2a: task is in a terminal state") )
Task store errors.
Functions ¶
func NewExecutor ¶
NewExecutor returns the shared A2A executor from runtime/a2a.
Types ¶
type InMemoryTaskStore ¶
type InMemoryTaskStore struct {
// contains filtered or unexported fields
}
InMemoryTaskStore is a concurrency-safe, in-memory implementation of TaskStore.
func NewInMemoryTaskStore ¶
func NewInMemoryTaskStore() *InMemoryTaskStore
NewInMemoryTaskStore creates a new InMemoryTaskStore.
func (*InMemoryTaskStore) AddArtifacts ¶
func (s *InMemoryTaskStore) AddArtifacts(taskID string, artifacts []rta2a.Artifact) error
AddArtifacts appends artifacts to a task.
func (*InMemoryTaskStore) Cancel ¶
func (s *InMemoryTaskStore) Cancel(taskID string) error
Cancel transitions the task to the canceled state from any non-terminal state.
func (*InMemoryTaskStore) Create ¶
func (s *InMemoryTaskStore) Create(taskID, contextID string) (*rta2a.Task, error)
Create initializes a new task in the submitted state.
func (*InMemoryTaskStore) EvictTerminal ¶
func (s *InMemoryTaskStore) EvictTerminal(cutoff time.Time) []string
EvictTerminal removes tasks in a terminal state whose last status timestamp is older than cutoff. It returns the IDs of evicted tasks.
func (*InMemoryTaskStore) Get ¶
func (s *InMemoryTaskStore) Get(taskID string) (*rta2a.Task, error)
Get retrieves a task by ID.
type TaskStore ¶
type TaskStore interface {
Create(taskID, contextID string) (*rta2a.Task, error)
Get(taskID string) (*rta2a.Task, error)
SetState(taskID string, state rta2a.TaskState, msg *rta2a.Message) error
AddArtifacts(taskID string, artifacts []rta2a.Artifact) error
Cancel(taskID string) error
List(contextID string, limit, offset int) ([]*rta2a.Task, error)
// EvictTerminal removes tasks in a terminal state whose last status
// timestamp is older than the given cutoff time. It returns the IDs
// of evicted tasks so callers can clean up associated resources.
EvictTerminal(olderThan time.Time) []string
}
TaskStore defines the interface for task persistence and lifecycle management.