runtime

package
v0.0.0-...-dfb39b5 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Runtime

Runtime creates a new Agent Runtime.

Types

type AgentRequest

type AgentRequest struct {
	AgentID        uint64         `json:"agentID,string"`
	Input          string         `json:"input"`
	ConversationID uint64         `json:"conversationID,string"`
	ExecContext    map[string]any `json:"execContext"` // User/system context
	Attachments    []Attachment   `json:"attachments"`
}

AgentRequest represents the input for an agent execution.

type AgentResponse

type AgentResponse struct {
	Output         string         `json:"output"`
	ConversationID uint64         `json:"conversationID,string"`
	ToolCalls      []ToolCallInfo `json:"toolCalls"`
	Decisions      []DecisionInfo `json:"decisions"`
	Usage          Usage          `json:"usage"`
	Context        string         `json:"context,omitempty"`
}

AgentResponse represents the output of an agent execution.

type Attachment

type Attachment struct {
	Name      string `json:"name"`
	MediaType string `json:"mediaType"`
	Content   []byte `json:"content"` // Or a stream/reader if needed
}

Attachment represents a file or image attached to the request.

type ConversationStore

type ConversationStore interface {
	FindByID(ctx context.Context, ID uint64) (*types.AiConversation, error)
	Create(ctx context.Context, new *types.AiConversation) (*types.AiConversation, error)
	Update(ctx context.Context, upd *types.AiConversation) (*types.AiConversation, error)
	DeleteByID(ctx context.Context, ID uint64) error
}

ConversationStore manages conversation persistence. Satisfied by system/service.AiConversation().

type DecisionInfo

type DecisionInfo struct {
	Iteration int      `json:"iteration"`
	Decision  string   `json:"decision"`
	Tools     []string `json:"tools,omitempty"`
	Reasoning string   `json:"reasoning,omitempty"`
	Usage     Usage    `json:"usage"`
}

type KnowledgeBaseStore

type KnowledgeBaseStore interface {
	FindByID(ctx context.Context, ID uint64) (*types.KnowledgeBase, error)
}

type LLMClient

type LLMClient interface {
	// Chat interacts with the LLM.
	// It takes the agent definition (for system prompt/config), current history, and available tools.
	Chat(ctx context.Context, prompt string, history []types.AiConversationMessage, tools []Tool, config LLMConfig) (*LLMResponse, error)
}

LLMClient abstracts the LLM provider.

type LLMConfig

type LLMConfig struct {
	ProviderID   uint64
	Model        string
	Temperature  *float64
	OutputTokens int
}

type LLMResponse

type LLMResponse struct {
	Text      string
	ToolCalls []ToolCall
	Usage     Usage
}

type MCPClient

type MCPClient interface {
	// GetTools returns tools filtered to the agent's allowed tool list.
	GetTools(ctx context.Context, allowedTools []string) ([]Tool, error)
	// ExecuteTool executes a specific tool.
	ExecuteTool(ctx context.Context, toolName string, args map[string]any) (any, error)
}

MCPClient abstracts the Model Context Protocol tools.

type ModHandle

type ModHandle struct {
	ID             uint64
	NamespaceID    uint64
	Handle         string
	Name           string
	CreatedByAgent uint64
}

type NsHandle

type NsHandle struct {
	ID             uint64
	Handle         string
	Name           string
	CreatedByAgent uint64
}

type NsModResolver

type NsModResolver interface {
	Resolve(ctx context.Context, namespace, module string) (nsID, modID uint64, err error)
	LookupNamespace(ctx context.Context, id uint64) (NsHandle, error)
	LookupModule(ctx context.Context, nsID, modID uint64) (ModHandle, error)
}

type Registry

type Registry interface {
	Get(ctx context.Context, id uint64) (*types.Agent, error)
}

Registry interface for fetching agent definitions

type TAQService

type TAQService interface {
	LookupByID(ctx context.Context, ID uint64) (*autoTypes.NgAutomation, error)
	LookupByHandle(ctx context.Context, handle string) (*autoTypes.NgAutomation, error)
}

type Tool

type Tool struct {
	Name        string         `json:"name"`
	Title       string         `json:"title,omitempty"`
	Description string         `json:"description"`
	InputSchema map[string]any `json:"inputSchema"`
}

type ToolCall

type ToolCall struct {
	ID   string
	Name string
	Args map[string]any
}

type ToolCallInfo

type ToolCallInfo struct {
	Tool       string         `json:"tool"`
	Args       map[string]any `json:"args"`
	Result     any            `json:"result"`
	Error      string         `json:"error,omitempty"`
	DurationMs int            `json:"durationMs"`
}

ToolCallInfo describes a tool call that was executed.

type Usage

type Usage struct {
	InputTokens   int `json:"inputTokens"`
	OutputTokens  int `json:"outputTokens"`
	ContextWindow int `json:"contextWindow"`
}

Usage tracks token usage.

type WorkflowService

type WorkflowService interface {
	LookupByID(ctx context.Context, ID uint64) (*autoTypes.Workflow, error)
	LookupByHandle(ctx context.Context, handle string) (*autoTypes.Workflow, error)
}

Jump to

Keyboard shortcuts

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