agent

package
v0.2.2 Latest Latest
Warning

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

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

Documentation

Overview

Package agent provides the model-facing Task, Session child and Subagent tool contract over a Host-owned durable lifecycle.

Index

Constants

View Source
const (
	TasksSpawnName          = "tasks_spawn"
	TasksWaitName           = "tasks_wait"
	TasksRunName            = "tasks_run"
	TasksCancelName         = "tasks_cancel"
	TasksReplayName         = "tasks_replay"
	TasksCollectName        = "tasks_collect"
	TasksDeadletterListName = "tasks_deadletter_list"
	SubagentsName           = "subagents"
	AgentStepName           = "agent_step"
)

Variables

This section is empty.

Functions

func AgentStepDefinition

func AgentStepDefinition() toolcontract.Definition

func Definitions

func Definitions() []toolcontract.Definition

Definitions returns the complete model-facing catalog in stable order.

func NewAgentStepHandler

func NewAgentStepHandler(backend Backend) toolcontract.Handler

NewAgentStepHandler parses one bounded child step and hands it to the Host.

func NewSubagentsHandler

func NewSubagentsHandler(backend Backend) toolcontract.Handler

NewSubagentsHandler owns the model-facing action contract and routes it to a Host lifecycle backend. It deliberately does not own Store or Scheduler policy.

func NewTaskHandler

func NewTaskHandler(name string, backend Backend) toolcontract.Handler

NewTaskHandler constructs deterministic argument parsing and Host dispatch for one direct task lifecycle tool.

func Register

func Register(reg toolcontract.Registrar, opts Options)

Register installs the portable Task/Subagent tool cohort over a Host Backend.

func SubagentsDefinition

func SubagentsDefinition() toolcontract.Definition

func TasksCancelDefinition

func TasksCancelDefinition() toolcontract.Definition

func TasksCollectDefinition

func TasksCollectDefinition() toolcontract.Definition

func TasksDeadletterListDefinition

func TasksDeadletterListDefinition() toolcontract.Definition

func TasksReplayDefinition

func TasksReplayDefinition() toolcontract.Definition

func TasksRunDefinition

func TasksRunDefinition() toolcontract.Definition

func TasksSpawnDefinition

func TasksSpawnDefinition() toolcontract.Definition

func TasksWaitDefinition

func TasksWaitDefinition() toolcontract.Definition

Types

type Backend

type Backend interface {
	ExecuteTask(context.Context, Request) (string, error)
	ExecuteSubagent(context.Context, Request) (string, error)
	ExecuteAgentStep(context.Context, Request) (string, error)
}

Backend executes Task, Subagent and bounded Agent Step requests against a Host-owned lifecycle implementation.

type BackendFuncs

type BackendFuncs struct {
	TaskFunc      func(context.Context, Request) (string, error)
	SubagentFunc  func(context.Context, Request) (string, error)
	AgentStepFunc func(context.Context, Request) (string, error)
}

BackendFuncs adapts private Host functions without exporting Host types.

func (BackendFuncs) ExecuteAgentStep

func (b BackendFuncs) ExecuteAgentStep(ctx context.Context, request Request) (string, error)

func (BackendFuncs) ExecuteSubagent

func (b BackendFuncs) ExecuteSubagent(ctx context.Context, request Request) (string, error)

func (BackendFuncs) ExecuteTask

func (b BackendFuncs) ExecuteTask(ctx context.Context, request Request) (string, error)

type Options

type Options struct {
	Enabled []string
	Backend Backend
}

Options controls which model-facing tools are registered. An empty Enabled list registers the entire cohort, matching the existing AgentX Host behavior.

type Request

type Request struct {
	Name      string
	Action    string
	Arguments map[string]any
}

Request is a normalized model-tool request. Arguments is a defensive copy. Concrete identity, persistence, authorization and scheduling remain Host-owned.

Jump to

Keyboard shortcuts

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