Documentation
¶
Overview ¶
Package agents is the public Go authoring surface for GoBeyond agents.
An agent is authored in agents/<id>/agent.go as an exported package var:
var Agent = agents.Define(agents.Config{Durable: true}, Run, agents.Slots{...})
The project compiler reads that declaration without executing it. Direct execution is the zero-value default; Durable opts the agent into a durable run and requires the generated workflow wiring supplied by the compiler.
Index ¶
- Constants
- func ToolTaskQueue(tool AITool) string
- type AIConfig
- type AIDefinition
- func (definition AIDefinition) Invoke(ctx context.Context, actor Actor, input AIInput) (AIOutput, error)
- func (definition AIDefinition) LanguageModel() (ai.LanguageModel, error)
- func (definition AIDefinition) RuntimeProvider() ai.Provider
- func (definition AIDefinition) Stream(ctx context.Context, actor Actor, input AIInput) (*ai.StreamTextResult, error)
- func (definition AIDefinition) ValidateRegistration() error
- type AIInput
- type AIMessage
- type AIMessagePart
- type AIOutput
- type AITool
- type Actor
- type Channel
- type Config
- type Definition
- type DurableRunInput
- type DurableRunOutput
- type DurableUpdateStore
- type Handler
- type Mode
- type ModelMetadata
- type Run
- type Schedule
- type Session
- type Skill
- type Slots
- type Subagent
- type Tool
- type ToolConfig
- type ToolHandler
Constants ¶
const LoopbackDevActorID = "dev-loopback"
LoopbackDevActorID identifies the development-only loopback actor.
Variables ¶
This section is empty.
Functions ¶
func ToolTaskQueue ¶
ToolTaskQueue returns the logical task queue embedded by DefineTool. It is used by compiler-generated durable dispatch and never interpreted by model providers.
Types ¶
type AIConfig ¶
type AIConfig struct {
TaskQueue string
Durable bool
Realtime bool
Public bool
Model string
MaxSteps int
Tools map[string]ai.Tool
Provider ai.Provider
Instructions string
Revision string
DurableUpdates DurableUpdateStore
OnReviewPublicationFailure func(context.Context, updates.UpdateEvent, error)
}
AIConfig declares a framework-owned model/tool loop. Model uses provider/model syntax for the built-in providers (anthropic, openrouter, bedrock, and vertex). Provider may be supplied for a custom provider; its credentials and mutable configuration remain runtime-only.
type AIDefinition ¶
AIDefinition is the fixed conversational agent definition produced by DefineAI. The compiler fills Instructions and Revision from instructions.md and the compiled filesystem definition.
func DefineAI ¶
func DefineAI(config AIConfig, slots ...Slots) AIDefinition
DefineAI declares a framework-owned conversational AI agent. The authored folder must also contain instructions.md; the project compiler embeds it in the generated registration.
func (AIDefinition) Invoke ¶
func (definition AIDefinition) Invoke(ctx context.Context, actor Actor, input AIInput) (AIOutput, error)
Invoke runs the Go AI SDK tool loop without exposing provider construction, prompt conversion, or callback plumbing to authored agents.
func (AIDefinition) LanguageModel ¶
func (definition AIDefinition) LanguageModel() (ai.LanguageModel, error)
LanguageModel resolves the authored model reference. Built-in providers read their normal environment credentials; no secret is copied into manifests or Temporal workflow input.
func (AIDefinition) RuntimeProvider ¶
func (definition AIDefinition) RuntimeProvider() ai.Provider
RuntimeProvider binds Temporal activity lookups to this process-local definition. Provider values are never serialized into workflow input.
func (AIDefinition) Stream ¶
func (definition AIDefinition) Stream(ctx context.Context, actor Actor, input AIInput) (*ai.StreamTextResult, error)
Stream starts the Go AI SDK streaming tool loop. The caller owns consuming the returned stream before reading its final result fields.
func (AIDefinition) ValidateRegistration ¶
func (definition AIDefinition) ValidateRegistration() error
ValidateRegistration rejects capabilities that the native GoBeyond agent transport cannot complete safely yet. Approval-gated tools must not enter either direct or durable registries until pending interactions are delivered through the native session event contract.
type AIInput ¶
type AIInput struct {
Prompt string `json:"prompt,omitempty"`
Message string `json:"message,omitempty"`
Text string `json:"text,omitempty"`
Messages []AIMessage `json:"messages,omitempty"`
}
AIInput accepts both prompt-oriented callers and AI SDK chat transports. Prompt wins over the Message/Text convenience aliases when more than one is provided.
func (AIInput) PromptText ¶
PromptText and ToAIMessages expose the canonical conversion to framework runtimes while keeping transport-specific UI message parsing in one place.
type AIMessage ¶
type AIMessage struct {
Role string `json:"role"`
Content string `json:"content,omitempty"`
Parts []AIMessagePart `json:"parts,omitempty"`
}
AIMessage is the text-message subset shared by the native HTTP client and AI SDK chat transports. Content supports simple clients; Parts supports AI SDK UIMessage text parts.
type AIMessagePart ¶
type AIOutput ¶
type AIOutput struct {
Text string `json:"text"`
FinishReason string `json:"finishReason,omitempty"`
RawFinishReason string `json:"rawFinishReason,omitempty"`
Model string `json:"model,omitempty"`
}
AIOutput is the stable native agent.output payload for both direct and durable AI agents.
type AITool ¶
AITool is the Go AI SDK tool definition used by a filesystem agent. Keeping the alias here lets authored agents define tools without importing framework runtime packages.
func DefineTool ¶
func DefineTool[Input any, Output any](config ToolConfig, handler ToolHandler[Input, Output]) AITool
DefineTool adapts a typed, actor-aware application function to the Go AI SDK tool contract. Model input is schema-validated by go-ai before this decoder runs; the authenticated actor comes from framework-owned runtime context.
type Actor ¶
type Actor struct {
ID string `json:"id"`
Kind string `json:"kind"`
Metadata map[string]string `json:"metadata,omitempty"`
}
Actor is the authenticated principal that invoked an agent. Identity is explicit so direct and durable invocations have the same author-facing type.
func DevLoopbackActor ¶
func DevLoopbackActor() Actor
DevLoopbackActor is an alias for LoopbackDevActor kept for call sites that read the environment qualifier first.
func LoopbackDevActor ¶
func LoopbackDevActor() Actor
LoopbackDevActor returns the typed actor used by local development when no external identity provider is configured. Hosted runtimes must supply their authenticated actor explicitly.
type Config ¶
type Config struct {
TaskQueue string
Durable bool
// Realtime keeps the agent durable while selecting a compiler-owned,
// agent-unique task queue and local model/tool activity boundaries. It is
// intentionally an execution hint rather than a persistence mode.
Realtime bool
Public bool
}
Config is compiler-visible agent metadata. TaskQueue is a logical queue name; generated durable workers append the active environment suffix.
type Definition ¶
type Definition[Input any, Output any] struct { Config Config Handler Handler[Input, Output] Slots Slots }
Definition associates compiler-visible metadata with a typed handler.
func Define ¶
func Define[Input any, Output any](config Config, handler Handler[Input, Output], slots ...Slots) Definition[Input, Output]
Define declares an agent. Omitting slots is equivalent to Slots{}.
func (Definition[Input, Output]) Invoke ¶
func (definition Definition[Input, Output]) Invoke(ctx context.Context, actor Actor, input Input) (Output, error)
Invoke runs the typed handler after validating the actor. Durable dispatch is intentionally compiler/runtime-owned; this method remains useful for direct agents and loopback development tests.
type DurableRunInput ¶
type DurableRunInput struct {
Session Session `json:"session"`
Run Run `json:"run"`
Actor Actor `json:"actor"`
Input json.RawMessage `json:"input"`
}
DurableRunInput is the serialization contract shared by the HTTP Temporal dispatcher and compiler-generated durable agent workflows. Generated workflows pass Input to the typed agent activity after decoding it there.
type DurableRunOutput ¶
type DurableRunOutput struct {
Output json.RawMessage `json:"output"`
}
DurableRunOutput is returned by compiler-generated durable agent workflows. Output must contain one complete JSON value so the transport can publish the same agent.output event shape used by direct agents.
type DurableUpdateStore ¶
type DurableUpdateStore interface {
updates.PreviewStore
updates.RecordStore
}
DurableUpdateStore is the customer-owned durable half of a hosted agent conversation connector. GoBeyond never receives its credentials. Hosted workers compose it with the slot-private host review publisher; local workers keep using the durable store without requiring platform services.
type ModelMetadata ¶
type ModelMetadata struct {
Provider string `json:"provider,omitempty"`
Model string `json:"model,omitempty"`
}
ModelMetadata identifies the model selected for a run without leaking provider credentials or mutable runtime configuration into authored code.
type Run ¶
type Run struct {
ID string `json:"id"`
SessionID string `json:"sessionId"`
AgentID string `json:"agentId"`
Mode Mode `json:"mode"`
TaskQueue string `json:"taskQueue,omitempty"`
Model ModelMetadata `json:"model,omitempty"`
Status string `json:"status"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
}
Run is one execution attempt in a session. TaskQueue is empty for direct runs unless the host records a selected logical queue for observability.
type Session ¶
type Session struct {
ID string `json:"id"`
AgentID string `json:"agentId"`
Actor Actor `json:"actor"`
Model ModelMetadata `json:"model,omitempty"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
Metadata map[string]string `json:"metadata,omitempty"`
}
Session is the durable conversation identity shared by one or more runs.
type Slots ¶
type Slots struct {
Tools []Tool
Skills []Skill
Subagents []Subagent
Schedules []Schedule
Channels []Channel
}
Slots declares every extensibility slot on an agent in one compiler-visible literal. Empty slots are valid and do not change the direct default.
type Tool ¶
type Tool struct {
ID string
}
Tool, Skill, Subagent, Schedule, and Channel are compiler-visible slots. IDs are stable authored references; their provider-specific implementations are deliberately kept outside this initial package boundary.
type ToolConfig ¶
type ToolConfig struct {
Name string
Title string
Description string
// TaskQueue is a logical Temporal queue. Durable agents inherit their own
// resolved queue when this is empty. Realtime agents reject explicit tool
// queues because their tools execute as local activities.
TaskQueue string
InputSchema any
OutputSchema any
RequiresApproval bool
}
ToolConfig is the provider-neutral authoring surface for a model-callable function. Schemas use ordinary JSON Schema values (usually map[string]any).
Directories
¶
| Path | Synopsis |
|---|---|
|
Package httpruntime provides the local HTTP transport for GoBeyond agents.
|
Package httpruntime provides the local HTTP transport for GoBeyond agents. |
|
Package temporalruntime dispatches durable agent runs to compiler-generated Temporal workflows.
|
Package temporalruntime dispatches durable agent runs to compiler-generated Temporal workflows. |