agentservice

package
v0.36.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AgentsMDMessage

func AgentsMDMessage(content, path string) taskengine.Message

func ComposeUserInput added in v0.36.0

func ComposeUserInput(input string, contextBundle map[string]any) string

ComposeUserInput renders the effective user message the model sees: per-turn context artifacts (from Beam's ArtifactRegistry, sent as {artifacts: [{kind, payload}, ...]}) are prepended as an "Additional context" block. Plain input passes through unchanged.

Types

type Agent

type Agent interface {
	Capabilities(ctx context.Context) (*AgentCapabilities, error)
	SessionNew(ctx context.Context, name string) (string, error)
	SessionList(ctx context.Context) ([]*SessionInfo, error)
	SessionLoad(ctx context.Context, name string) (contenoxSessionID string, messages []taskengine.Message, err error)
	// SessionResume switches to an existing session without loading its
	// message history — the reconnect path for clients that kept their
	// transcript.
	SessionResume(ctx context.Context, name string) (contenoxSessionID string, err error)
	// SessionDelete removes a session and its messages by name; missing
	// sessions are not an error (delete is idempotent).
	SessionDelete(ctx context.Context, name string) error
	SessionEnsureDefault(ctx context.Context) (string, error)
	Prompt(ctx context.Context, req PromptRequest) (*PromptResponse, error)
}

func New

func New(deps Deps) Agent

type AgentCapabilities

type AgentCapabilities struct {
	LocalTools      []string
	MCPServers      []string
	SupportsSession bool
}

type Deps

type Deps struct {
	Engine      *enginesvc.Engine
	DB          libdb.DBManager
	WorkspaceID string
	Identity    string
}

type NoopObserver

type NoopObserver struct{}

func (NoopObserver) OnStepCompleted

func (NoopObserver) OnStepCompleted(taskengine.CapturedStateUnit)

type Observer

type Observer interface {
	OnStepCompleted(step taskengine.CapturedStateUnit)
}

type PromptRequest

type PromptRequest struct {
	SessionID      string
	Input          string
	InputType      taskengine.DataType
	InputValue     any
	Chain          *taskengine.TaskChainDefinition
	TemplateVars   map[string]string
	ToolsAllowlist []string
	ContextLength  int
	HistoryTrim    int
	Observer       Observer
	AgentsMD       string
	AgentsMDSource string

	// Per-turn context artifacts from Beam ({artifacts: []ChatContextArtifact-like}),
	// injected into the model-visible user message by ComposeUserInput.
	Context map[string]any

	// ChainRef is the chain path used for this turn (e.g. "default-chain.json").
	// Stamped onto persisted messages as turn provenance; not used for execution.
	ChainRef string
}

type PromptResponse

type PromptResponse struct {
	Output     any
	OutputType taskengine.DataType
	Steps      []taskengine.CapturedStateUnit
	StopReason StopReason
}

type SessionInfo

type SessionInfo struct {
	ID           string
	Name         string
	MessageCount int
	IsActive     bool
}

type StopReason

type StopReason string
const (
	StopEndTurn         StopReason = "end_turn"
	StopMaxTokens       StopReason = "max_tokens"
	StopMaxTurnRequests StopReason = "max_turn_requests"
	StopCancelled       StopReason = "cancelled"
)

func InferStopReason

func InferStopReason(err error, steps []taskengine.CapturedStateUnit) StopReason

Jump to

Keyboard shortcuts

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