Documentation
¶
Overview ¶
Package agentprofile implements the AgentProfile server-side resource: the declarative image/engine/limits, secret:// model-credential references, session budgets, and default playbook a job's metadata.remediation.profile field references (docs/design-agent-in-the-loop.md "Declarative policy", Stream E2). It mirrors the api/rest/service/notification channel CRUD shape.
Index ¶
Constants ¶
const DefaultTriageOnlyProfileName = models.DefaultTriageOnlyProfileName
DefaultTriageOnlyProfileName is the shipped zero-risk default profile name. It is defined canonically on the model so internal/jobdef's server-side lint can treat it as always resolvable; re-exported here for callers of this package.
Variables ¶
var ( ErrInvalidProfile = errors.New("invalid agent profile") ErrProfileNameConflict = errors.New("agent profile name conflict") )
Functions ¶
func SeedDefaults ¶
SeedDefaults idempotently creates the shipped triage-only default profile (tier 0 + escalate; zero-risk) if it does not already exist, so a fresh deployment always has one AgentProfile a job can reference to adopt remediation incrementally. Safe to call concurrently / repeatedly: the unique name index makes the create a no-op race rather than a duplicate. A nil connection is a retryable failure (not a silent no-op) so ensureSeeded tries again once the DB is reachable rather than marking seeding done.
Types ¶
type CreateRequest ¶
type CreateRequest struct {
Name string `json:"name"`
Image string `json:"image"`
Engine models.AtomEngine `json:"engine,omitempty"`
Limits map[string]any `json:"limits,omitempty"`
SecretRefs map[string]string `json:"secret_refs,omitempty"`
Budgets map[string]any `json:"budgets,omitempty"`
Playbook map[string]any `json:"playbook,omitempty"`
}
type ListRequest ¶
type Service ¶
type Service interface {
List(req *ListRequest) ([]models.AgentProfile, error)
Get(id uuid.UUID) (*models.AgentProfile, error)
Create(req *CreateRequest) (*models.AgentProfile, error)
Update(id uuid.UUID, req *UpdateRequest) (*models.AgentProfile, error)
Delete(id uuid.UUID) error
}
Service manages AgentProfile resources.
func New ¶
New returns a new AgentProfile service. It lazily seeds the shipped triage-only default profile (idempotent — guarded by the unique name index as well as the double-checked flag) so a fresh deployment has a zero-risk profile to reference without an operator having to author one by hand. A failed seed is retried on a later call.
type UpdateRequest ¶
type UpdateRequest struct {
Name *string `json:"name,omitempty"`
Image *string `json:"image,omitempty"`
Engine *models.AtomEngine `json:"engine,omitempty"`
Limits map[string]any `json:"limits,omitempty"`
SecretRefs map[string]string `json:"secret_refs,omitempty"`
Budgets map[string]any `json:"budgets,omitempty"`
Playbook map[string]any `json:"playbook,omitempty"`
}