Documentation
¶
Overview ¶
Package templates is the OSS-side registry of curated agent presets and workflow templates. The registries are hardcoded Go literals — no database tables, no on-disk YAML, no hot-reload — because the contents are part of the binary's shipped surface, not user data.
Two registries:
presetRegistry: a slice of AgentPresetInfo, one entry per AgentPreset enum value. Each entry packages defaults the server merges into a user-supplied CreateAgentRequest (only zero-value fields are filled, so the caller's preferences always win).
workflowTemplateRegistry: a slice of WorkflowTemplateInfo, one entry per WorkflowTemplate enum value. Each template lists the agent slots it creates (each referencing a preset for baseline config plus a curated system prompt) and a fully-realized WorkflowPattern with stage prompts pre-filled. Agent ids are slotted in by the server's CreateWorkflowFromTemplate handler at instantiation time.
The registries are mirrored from the Loom Cloud scaffolding system but augmented with OSS-only tools — research_analyst gets parse_document, task_automator gets shell_execute + file_read + file_write, etc. Cloud's tool-name skew (no web_browse, no shell access) is corrected where the OSS catalog provides equivalents.
Index ¶
- func GetPreset(p loomv1.AgentPreset) *loomv1.AgentPresetInfo
- func GetWorkflowTemplate(t loomv1.WorkflowTemplate) *loomv1.WorkflowTemplateInfo
- func ListPresets() []*loomv1.AgentPresetInfo
- func ListWorkflowTemplates() []*loomv1.WorkflowTemplateInfo
- func PresetEnumFromString(s string) loomv1.AgentPreset
- func PresetEnumToString(p loomv1.AgentPreset) string
- func WorkflowTemplateEnumFromString(s string) loomv1.WorkflowTemplate
- func WorkflowTemplateEnumToString(t loomv1.WorkflowTemplate) string
- type AppliedPreset
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetPreset ¶
func GetPreset(p loomv1.AgentPreset) *loomv1.AgentPresetInfo
GetPreset returns the preset matching enum, or nil if the enum is UNSPECIFIED / unknown. Callers should treat nil as "no preset; do not apply defaults".
func GetWorkflowTemplate ¶
func GetWorkflowTemplate(t loomv1.WorkflowTemplate) *loomv1.WorkflowTemplateInfo
GetWorkflowTemplate returns the template matching enum, or nil for UNSPECIFIED / unknown.
func ListPresets ¶
func ListPresets() []*loomv1.AgentPresetInfo
ListPresets returns every registered preset. The returned slice is the shared registry — callers must not mutate entries. Suitable for protobuf response marshaling since each entry is already a *loomv1.AgentPresetInfo.
func ListWorkflowTemplates ¶
func ListWorkflowTemplates() []*loomv1.WorkflowTemplateInfo
ListWorkflowTemplates returns every registered template. The returned slice is the shared registry — callers must not mutate entries.
func PresetEnumFromString ¶
func PresetEnumFromString(s string) loomv1.AgentPreset
PresetEnumFromString maps a preset name (cloud-compatible snake_case) to the corresponding enum. Returns UNSPECIFIED for unknown strings so the caller can distinguish "valid but unknown" from "valid".
func PresetEnumToString ¶
func PresetEnumToString(p loomv1.AgentPreset) string
PresetEnumToString is the inverse of PresetEnumFromString. Returns the empty string for UNSPECIFIED so callers can detect a missing preset.
func WorkflowTemplateEnumFromString ¶
func WorkflowTemplateEnumFromString(s string) loomv1.WorkflowTemplate
WorkflowTemplateEnumFromString resolves a kebab-case template name to its enum. Returns UNSPECIFIED for unknown strings.
func WorkflowTemplateEnumToString ¶
func WorkflowTemplateEnumToString(t loomv1.WorkflowTemplate) string
WorkflowTemplateEnumToString is the inverse of the From variant. Returns empty string for UNSPECIFIED so callers can detect a missing template.
Types ¶
type AppliedPreset ¶
type AppliedPreset struct {
Tools []string
MaxTurns int32
MaxToolExecutions int32
MaxIterations int32
TimeoutSeconds int32
Temperature float32
MaxTokens int32
MaxContextTokens int32
ReservedOutputTokens int32
HistoryWindowSize int32
OutputTokenCbThreshold int32
QueryToolResultThresholdBytes int64
MaxToolResults int32
GraphMemoryBudgetPercent int32
GraphMemoryMaxCandidates int32
ThinkingLevel string
WorkloadProfile string
Rom string
BackendType string
// Booleans surface as concrete bools after merge — callers wanting
// "was this set" semantics can compare against the preset directly.
CacheControlEnabled bool
GraphMemoryEnabled bool
AllowCodeExecution bool
}
AppliedPreset is the materialized result of merging preset defaults onto a user's CreateAgentRequest-like input. Callers convert this to whatever concrete request shape their RPC expects.
Merge semantics (matching cloud):
- Numeric and string fields use zero-value detection: user-supplied non-zero wins; otherwise preset default applies.
- Tools: if the user supplied any tools, those win entirely; otherwise the preset's tool list applies.
- Boolean fields (proto3 optional in PresetDefaults): preset's explicit setting wins when the user didn't override.
func ApplyPreset ¶
func ApplyPreset(p loomv1.AgentPreset, user AppliedPreset) AppliedPreset
ApplyPreset merges a preset's defaults onto a user-supplied AppliedPreset representing what the user explicitly requested. Returns a new struct; the input is not mutated. Numeric / string fields use zero-value detection; bool fields take the preset's explicit setting whenever the preset specifies one.