types

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentExecutionPlan

type AgentExecutionPlan struct {
	AgentName string `json:"agent_name" yaml:"agent_name"`
	Query     string `json:"query" yaml:"query"` // The specific sub-query for this agent
}

AgentExecutionPlan defines a single task for a specific agent, including the sub-query. This is an internal analysis result, users don't need to use it directly

type AgentRequirements

type AgentRequirements struct {
	ExecutionPlan []AgentExecutionPlan `json:"execution_plan" yaml:"execution_plan"`
	IsParallel    bool                 `json:"is_parallel" yaml:"is_parallel"`
	EstimatedTime time.Duration        `json:"estimated_time" yaml:"estimated_time"`
	Confidence    float64              `json:"confidence" yaml:"confidence"` // Analysis confidence (0-1)
	Reasoning     string               `json:"reasoning" yaml:"reasoning"`   // Reasoning behind the analysis
}

AgentRequirements describes the agents and plan needed to execute a task. This is the result of the internal LLM analysis.

type ExecutionHandle

type ExecutionHandle struct {
	ID         string                  `json:"id" yaml:"id"`
	TaskID     string                  `json:"task_id" yaml:"task_id"`
	Agent      string                  `json:"agent" yaml:"agent"`
	Status     ExecutionStatus         `json:"status" yaml:"status"`
	StartedAt  time.Time               `json:"started_at" yaml:"started_at"`
	StreamChan <-chan *StreamingResult `json:"-" yaml:"-"`
	// contains filtered or unexported fields
}

ExecutionHandle represents a handle to a running task execution.

func NewCompletedExecutionHandle

func NewCompletedExecutionHandle(id, taskID, agent string, result *Result) *ExecutionHandle

NewCompletedExecutionHandle creates a completed execution handle (for synchronous execution)

func NewExecutionHandle

func NewExecutionHandle(id, taskID, agent string, ctx context.Context) *ExecutionHandle

NewExecutionHandle creates a new execution handle

func (*ExecutionHandle) Cancel

func (eh *ExecutionHandle) Cancel() error

func (*ExecutionHandle) SetResult

func (eh *ExecutionHandle) SetResult(result *Result)

SetResult sets the execution result for the handle

func (*ExecutionHandle) Wait

func (eh *ExecutionHandle) Wait() (*Result, error)

Methods for ExecutionHandle

type ExecutionStatus

type ExecutionStatus string

ExecutionStatus represents the current state of task execution

const (
	ExecutionStatusPending   ExecutionStatus = "pending"
	ExecutionStatusRunning   ExecutionStatus = "running"
	ExecutionStatusCompleted ExecutionStatus = "completed"
	ExecutionStatusFailed    ExecutionStatus = "failed"
	ExecutionStatusCancelled ExecutionStatus = "cancelled"
)

type Result

type Result struct {
	TaskID      string                 `json:"task_id" yaml:"task_id"`
	ExecutionID string                 `json:"execution_id" yaml:"execution_id"`
	Agent       string                 `json:"agent" yaml:"agent"`
	Content     string                 `json:"content" yaml:"content"`
	Data        map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"`
	Metadata    map[string]interface{} `json:"metadata,omitempty" yaml:"metadata,omitempty"`
	Type        string                 `json:"type" yaml:"type"`
	StartedAt   time.Time              `json:"started_at" yaml:"started_at"`
	CompletedAt time.Time              `json:"completed_at" yaml:"completed_at"`
	Duration    time.Duration          `json:"duration" yaml:"duration"`
	Status      ExecutionStatus        `json:"status" yaml:"status"`
	Error       error                  `json:"error,omitempty" yaml:"error,omitempty"`
}

Result represents the final result of a task execution.

type StreamingResult

type StreamingResult struct {
	Type      string                 `json:"type" yaml:"type"`
	Agent     string                 `json:"agent" yaml:"agent"`
	Stage     string                 `json:"stage" yaml:"stage"`
	Content   string                 `json:"content" yaml:"content"`
	Data      map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"`
	Timestamp time.Time              `json:"timestamp" yaml:"timestamp"`
	Complete  bool                   `json:"complete" yaml:"complete"`
	Error     error                  `json:"error,omitempty" yaml:"error,omitempty"`
}

StreamingResult represents a single streaming output from an agent.

type Task

type Task struct {
	ID        string                 `json:"id" yaml:"id"`
	Query     string                 `json:"query" yaml:"query"`                         // User's simple query
	Context   map[string]interface{} `json:"context,omitempty" yaml:"context,omitempty"` // Optional context information
	Streaming bool                   `json:"streaming" yaml:"streaming"`                 // Whether streaming output is needed
	CreatedAt time.Time              `json:"created_at" yaml:"created_at"`
}

Task represents a simplified task definition for the Strato SDK system. Users only need to provide query, other analysis work is done internally by MasterAgent

func NewStreamingTask

func NewStreamingTask(query string) *Task

func NewTask

func NewTask(query string) *Task

Helper functions

func (*Task) GetContext

func (t *Task) GetContext(key string) (interface{}, bool)

GetContext retrieves a context value from the task.

func (*Task) SetContext

func (t *Task) SetContext(key string, value interface{})

SetContext sets a context value for the task.

func (*Task) Validate

func (t *Task) Validate() error

Validate checks if the task has all required fields and valid values.

type TaskError

type TaskError struct {
	Code    string `json:"code" yaml:"code"`
	Message string `json:"message" yaml:"message"`
}

TaskError represents task-specific errors

func (*TaskError) Error

func (e *TaskError) Error() string

Jump to

Keyboard shortcuts

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