api

package module
v1.10.4 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: MIT Imports: 33 Imported by: 0

Documentation

Overview

Package api provides Forge-style HTTP handlers for the Cortex agent system.

Every route asks the Authorizer passed with WithAuthorizer before it runs. Without one the module checks nobody, and resolveCheckpoint records the decided_by the caller asserts, so it is then fit only for a single-trust deployment, where every caller is trusted equally.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type A2AConversationResponse

type A2AConversationResponse struct {
	Conversation *a2a.Conversation `json:"conversation"`
	Messages     []*a2a.Envelope   `json:"messages"`
}

A2AConversationResponse is one messaging conversation with its transcript, oldest message first.

type API

type API struct {
	// contains filtered or unexported fields
}

API wires all Forge-style HTTP handlers together for the Cortex system.

func New

func New(eng *engine.Engine, router forge.Router, options ...Option) *API

New creates an API from a Cortex Engine.

func (*API) Handler

func (a *API) Handler() http.Handler

Handler returns the fully assembled http.Handler with all routes.

func (*API) RegisterRoutes

func (a *API) RegisterRoutes(router forge.Router) error

RegisterRoutes registers all Cortex API routes into the given Forge router with full OpenAPI metadata.

type ActionReq

type ActionReq struct {
	Type   string `json:"type"`
	Target string `json:"target,omitempty"`
	Value  any    `json:"value,omitempty"`
}

ActionReq is the request representation of a behavior action.

type AgentInboxRequest

type AgentInboxRequest struct {
	Name           string `path:"name" description:"Agent name"`
	ConversationID string `query:"conversation_id" description:"Only messages on this conversation"`
	IncludeRead    bool   `query:"include_read" description:"Include messages already read (default: unread only)"`
	Limit          int    `query:"limit" description:"Max results (default: 50)"`
}

AgentInboxRequest reads one agent's delivered messages.

type AgentInboxResponse

type AgentInboxResponse struct {
	Items []a2a.InboxItem `json:"items"`
}

AgentInboxResponse is what an agent has waiting for it.

type AgentOverrides

type AgentOverrides struct {
	Model           string   `json:"model,omitempty" description:"Override LLM model"`
	Temperature     *float64 `json:"temperature,omitempty" description:"Override temperature"`
	MaxSteps        int      `json:"max_steps,omitempty" description:"Override max steps"`
	MaxTokens       int      `json:"max_tokens,omitempty" description:"Override max tokens"`
	ReasoningLoop   string   `json:"reasoning_loop,omitempty" description:"Override reasoning loop"`
	SystemPrompt    string   `json:"system_prompt,omitempty" description:"Override system prompt"`
	PersonaRef      string   `json:"persona_ref,omitempty" description:"Override persona reference"`
	InlineSkills    []string `json:"inline_skills,omitempty" description:"Override inline skills"`
	InlineTraits    []string `json:"inline_traits,omitempty" description:"Override inline traits"`
	InlineBehaviors []string `json:"inline_behaviors,omitempty" description:"Override inline behaviors"`
	Tools           []string `json:"tools,omitempty" description:"Override tool list"`
}

AgentOverrides allows overriding agent configuration for a single run.

type Authorizer added in v1.10.3

type Authorizer interface {
	// Authorize is asked before every route runs, with the request's
	// context. It sees the operation and the context only, not the path
	// parameters or the body, which are bound after it; a rule about one
	// resource belongs in the host's own lookups. A nil error lets the
	// request through. Any other error
	// refuses it with 403, unless it wraps a cortex not-found or scope
	// error, which keeps the status that error has everywhere else in
	// the module. The error's text never reaches the response.
	Authorize(ctx context.Context, op Operation) error
	// DecidedBy is the name resolveCheckpoint records as the deciding
	// person, derived from the request's principal. It replaces any
	// decided_by the request body names. sendAgentMessage's from is not
	// derived: it stays the caller's own name for the sender, used for
	// attribution, while the reply token gates what a reply can resume.
	DecidedBy(ctx context.Context) (string, error)
}

Authorizer is the host's say over who may call the module.

Without one, every route is open to whoever reaches the router and resolveCheckpoint records the decided_by the request body names, so the module is then fit only for a single-trust deployment, where every caller is trusted equally.

type CancelRunRequest

type CancelRunRequest struct {
	RunID string `path:"id" description:"Run ID"`
}

CancelRunRequest is the request for cancelling a run.

type CheckpointResponse added in v1.10.3

type CheckpointResponse struct {
	cortex.Entity
	ID        id.CheckpointID   `json:"id"`
	RunID     id.AgentRunID     `json:"run_id"`
	AgentID   id.AgentID        `json:"agent_id"`
	Scope     cortex.Scope      `json:"scope"`
	Reason    string            `json:"reason"`
	StepIndex int               `json:"step_index"`
	State     string            `json:"state"`
	Decision  *DecisionResponse `json:"decision,omitempty"`
	Metadata  map[string]any    `json:"metadata,omitempty"`
}

CheckpointResponse is a checkpoint as the API serves it. It has no field for the decider's principal: the store keeps those codec bytes as the record of who decided, and they are the host's own.

type ClearConversationRequest

type ClearConversationRequest struct {
	Name      string `path:"name" description:"Agent name"`
	SessionID string `query:"session_id" description:"Session ID; defaults to the agent's default session for the caller's scope"`
}

ClearConversationRequest is the request for clearing conversation history.

type CloneAgentRequest

type CloneAgentRequest struct {
	Name    string `path:"name" description:"Source agent name"`
	NewName string `json:"new_name,omitempty" description:"Name for the clone; auto-generated if omitted"`
}

CloneAgentRequest is the request for cloning an agent.

type ClonePersonaRequest

type ClonePersonaRequest struct {
	Name    string `path:"name" description:"Source persona name"`
	NewName string `json:"new_name,omitempty" description:"Name for the clone; auto-generated if omitted"`
}

ClonePersonaRequest is the request for cloning a persona.

type CountSessionsRequest

type CountSessionsRequest struct {
	Name string `path:"name" description:"Agent name"`
}

CountSessionsRequest is the request for counting an agent's sessions.

type CountSessionsResponse

type CountSessionsResponse struct {
	Count int64 `json:"count"`
}

CountSessionsResponse wraps a session count.

type CreateAgentRequest

type CreateAgentRequest struct {
	Name            string         `json:"name" description:"Unique agent name"`
	Description     string         `json:"description,omitempty"`
	SystemPrompt    string         `json:"system_prompt" description:"Agent system prompt"`
	Model           string         `json:"model,omitempty" description:"LLM model (default: smart)"`
	Tools           []string       `json:"tools,omitempty" description:"Tool names (flat mode)"`
	MaxSteps        int            `json:"max_steps,omitempty"`
	MaxTokens       int            `json:"max_tokens,omitempty"`
	Temperature     float64        `json:"temperature,omitempty"`
	ReasoningLoop   string         `json:"reasoning_loop,omitempty"`
	PersonaRef      string         `json:"persona_ref,omitempty" description:"Persona name reference"`
	InlineSkills    []string       `json:"inline_skills,omitempty"`
	InlineTraits    []string       `json:"inline_traits,omitempty"`
	InlineBehaviors []string       `json:"inline_behaviors,omitempty"`
	Guardrails      map[string]any `json:"guardrails,omitempty"`
	Metadata        map[string]any `json:"metadata,omitempty"`
}

CreateAgentRequest is the request body for creating an agent.

type CreateBehaviorRequest

type CreateBehaviorRequest struct {
	Name          string         `json:"name" description:"Unique behavior name"`
	Description   string         `json:"description,omitempty"`
	Triggers      []TriggerReq   `json:"triggers,omitempty"`
	Actions       []ActionReq    `json:"actions,omitempty"`
	Priority      int            `json:"priority,omitempty"`
	RequiresSkill string         `json:"requires_skill,omitempty"`
	RequiresTrait string         `json:"requires_trait,omitempty"`
	Metadata      map[string]any `json:"metadata,omitempty"`
}

CreateBehaviorRequest is the request body for creating a behavior.

type CreateOrchestrationRequest

type CreateOrchestrationRequest struct {
	Name         string                      `json:"name" description:"Unique orchestration name"`
	Description  string                      `json:"description,omitempty"`
	Strategy     string                      `json:"strategy" description:"sequential|parallel|router|hierarchical|debate"`
	Participants []orchestration.Participant `json:"participants" description:"Agents taking part, with optional roles"`
	Settings     orchestration.Settings      `json:"settings,omitempty"`
	Metadata     map[string]any              `json:"metadata,omitempty"`
}

CreateOrchestrationRequest is the request body for creating an orchestration config.

type CreatePersonaRequest

type CreatePersonaRequest struct {
	Name               string               `json:"name" description:"Unique persona name"`
	Description        string               `json:"description,omitempty"`
	Identity           string               `json:"identity" description:"Self-description for system prompt"`
	Skills             []SkillAssignmentReq `json:"skills,omitempty"`
	Traits             []TraitAssignmentReq `json:"traits,omitempty"`
	Behaviors          []string             `json:"behaviors,omitempty"`
	CognitiveStyle     map[string]any       `json:"cognitive_style,omitempty"`
	CommunicationStyle map[string]any       `json:"communication_style,omitempty"`
	Perception         map[string]any       `json:"perception,omitempty"`
	Metadata           map[string]any       `json:"metadata,omitempty"`
}

CreatePersonaRequest is the request body for creating a persona.

type CreateSessionRequest

type CreateSessionRequest struct {
	Name     string         `path:"name" description:"Agent name"`
	Title    string         `json:"title,omitempty"`
	Metadata map[string]any `json:"metadata,omitempty"`
}

CreateSessionRequest is the request body for creating a session.

type CreateSkillRequest

type CreateSkillRequest struct {
	Name                 string            `json:"name" description:"Unique skill name"`
	Description          string            `json:"description,omitempty"`
	Tools                []ToolBindingReq  `json:"tools,omitempty" description:"Tool bindings with mastery"`
	Knowledge            []KnowledgeRefReq `json:"knowledge,omitempty" description:"Knowledge sources"`
	SystemPromptFragment string            `json:"system_prompt_fragment,omitempty"`
	Dependencies         []string          `json:"dependencies,omitempty"`
	DefaultProficiency   string            `json:"default_proficiency,omitempty"`
	Metadata             map[string]any    `json:"metadata,omitempty"`
}

CreateSkillRequest is the request body for creating a skill.

type CreateTraitRequest

type CreateTraitRequest struct {
	Name        string         `json:"name" description:"Unique trait name"`
	Description string         `json:"description,omitempty"`
	Dimensions  []DimensionReq `json:"dimensions,omitempty"`
	Influences  []InfluenceReq `json:"influences,omitempty"`
	Category    string         `json:"category,omitempty"`
	Metadata    map[string]any `json:"metadata,omitempty"`
}

CreateTraitRequest is the request body for creating a trait.

type DecisionResponse added in v1.10.3

type DecisionResponse struct {
	Approved  bool      `json:"approved"`
	DecidedBy string    `json:"decided_by,omitempty"`
	Reason    string    `json:"reason,omitempty"`
	DecidedAt time.Time `json:"decided_at"`
}

DecisionResponse is a checkpoint decision as the API serves it.

type DeleteAgentRequest

type DeleteAgentRequest struct {
	Name string `path:"name" description:"Agent name"`
}

DeleteAgentRequest is the request for deleting an agent.

type DeleteBehaviorRequest

type DeleteBehaviorRequest struct {
	Name string `path:"name" description:"Behavior name"`
}

DeleteBehaviorRequest is the request for deleting a behavior.

type DeleteOrchestrationRequest

type DeleteOrchestrationRequest struct {
	Name string `path:"name" description:"Orchestration name"`
}

DeleteOrchestrationRequest addresses an orchestration config by name.

type DeletePersonaRequest

type DeletePersonaRequest struct {
	Name string `path:"name" description:"Persona name"`
}

DeletePersonaRequest is the request for deleting a persona.

type DeleteSessionRequest

type DeleteSessionRequest struct {
	Name      string `path:"name" description:"Agent name"`
	SessionID string `path:"id" description:"Session ID"`
}

DeleteSessionRequest is the request for deleting a session.

type DeleteSkillRequest

type DeleteSkillRequest struct {
	Name string `path:"name" description:"Skill name"`
}

DeleteSkillRequest is the request for deleting a skill.

type DeleteTraitRequest

type DeleteTraitRequest struct {
	Name string `path:"name" description:"Trait name"`
}

DeleteTraitRequest is the request for deleting a trait.

type DimensionReq

type DimensionReq struct {
	Name      string  `json:"name"`
	LowLabel  string  `json:"low_label"`
	HighLabel string  `json:"high_label"`
	Value     float64 `json:"value"`
}

DimensionReq is the request representation of a personality dimension.

type GetA2AConversationRequest

type GetA2AConversationRequest struct {
	ID string `path:"id" description:"Conversation ID"`
}

GetA2AConversationRequest addresses one messaging conversation by ID.

type GetAgentRequest

type GetAgentRequest struct {
	Name string `path:"name" description:"Agent name"`
}

GetAgentRequest is the request for getting an agent by name.

type GetBehaviorRequest

type GetBehaviorRequest struct {
	Name string `path:"name" description:"Behavior name"`
}

GetBehaviorRequest is the request for getting a behavior by name.

type GetConversationRequest

type GetConversationRequest struct {
	Name      string `path:"name" description:"Agent name"`
	Limit     int    `query:"limit"`
	SessionID string `query:"session_id" description:"Session ID; defaults to the agent's default session for the caller's scope"`
}

GetConversationRequest is the request for getting conversation history.

type GetConversationResponse

type GetConversationResponse struct {
	Messages []memory.Message `json:"messages"`
}

GetConversationResponse wraps conversation messages.

type GetOrchestrationRequest

type GetOrchestrationRequest struct {
	Name string `path:"name" description:"Orchestration name"`
}

GetOrchestrationRequest addresses an orchestration config by name.

type GetOrchestrationRunRequest

type GetOrchestrationRunRequest struct {
	ID string `path:"id" description:"Orchestration run ID"`
}

GetOrchestrationRunRequest addresses an orchestration run by ID.

type GetPersonaRequest

type GetPersonaRequest struct {
	Name string `path:"name" description:"Persona name"`
}

GetPersonaRequest is the request for getting a persona by name.

type GetRunRequest

type GetRunRequest struct {
	RunID string `path:"id" description:"Run ID"`
}

GetRunRequest is the request for getting a run by ID.

type GetSessionRequest

type GetSessionRequest struct {
	Name      string `path:"name" description:"Agent name"`
	SessionID string `path:"id" description:"Session ID"`
}

GetSessionRequest is the request for getting a session by ID.

type GetSkillRequest

type GetSkillRequest struct {
	Name string `path:"name" description:"Skill name"`
}

GetSkillRequest is the request for getting a skill by name.

type GetToolSchemaRequest

type GetToolSchemaRequest struct {
	Name string `path:"name" description:"Tool name"`
}

GetToolSchemaRequest is the request for getting a tool's schema.

type GetTraitRequest

type GetTraitRequest struct {
	Name string `path:"name" description:"Trait name"`
}

GetTraitRequest is the request for getting a trait by name.

type InfluenceReq

type InfluenceReq struct {
	Target    string  `json:"target"`
	Value     any     `json:"value"`
	Condition string  `json:"condition,omitempty"`
	Weight    float64 `json:"weight,omitempty"`
}

InfluenceReq is the request representation of a trait influence.

type KnowledgeRefReq

type KnowledgeRefReq struct {
	Source     string `json:"source"`
	InjectMode string `json:"inject_mode,omitempty"`
	Priority   int    `json:"priority,omitempty"`
}

KnowledgeRefReq is the request representation of a knowledge reference.

type ListA2AConversationsRequest

type ListA2AConversationsRequest struct {
	Status string `query:"status" description:"Filter by status: open|closed|expired"`
	Limit  int    `query:"limit" description:"Max results (default: 50)"`
	Offset int    `query:"offset" description:"Results to skip"`
}

ListA2AConversationsRequest paginates and filters messaging conversations. The a2a prefix is not decoration: "conversation" already means an agent's chat history elsewhere in this API, and these are the other kind.

type ListA2AConversationsResponse

type ListA2AConversationsResponse struct {
	Items []*a2a.Conversation `json:"items"`
}

ListA2AConversationsResponse is a page of messaging conversations.

type ListAgentsRequest

type ListAgentsRequest struct {
	Limit  int `query:"limit" description:"Max results (default: 50)"`
	Offset int `query:"offset" description:"Results to skip"`
}

ListAgentsRequest is the request for listing agents.

type ListAgentsResponse

type ListAgentsResponse struct {
	Items []*agent.Config `json:"items"`
}

ListAgentsResponse wraps a list of agents.

type ListBehaviorsRequest

type ListBehaviorsRequest struct {
	Limit  int `query:"limit"`
	Offset int `query:"offset"`
}

ListBehaviorsRequest is the request for listing behaviors.

type ListBehaviorsResponse

type ListBehaviorsResponse struct {
	Items []*behavior.Behavior `json:"items"`
}

ListBehaviorsResponse wraps a list of behaviors.

type ListCheckpointsRequest

type ListCheckpointsRequest struct {
	Limit  int `query:"limit"`
	Offset int `query:"offset"`
}

ListCheckpointsRequest is the request for listing pending checkpoints.

type ListCheckpointsResponse

type ListCheckpointsResponse struct {
	Items []*CheckpointResponse `json:"items"`
}

ListCheckpointsResponse wraps a list of checkpoints.

type ListOrchestrationRunsRequest

type ListOrchestrationRunsRequest struct {
	Status string `query:"status" description:"Filter by status: running|waiting|completed|failed"`
	Limit  int    `query:"limit"`
	Offset int    `query:"offset"`
}

ListOrchestrationRunsRequest paginates and filters orchestration runs.

type ListOrchestrationRunsResponse

type ListOrchestrationRunsResponse struct {
	Items []*orchestration.Run `json:"items"`
}

ListOrchestrationRunsResponse wraps a list of orchestration runs.

type ListOrchestrationsRequest

type ListOrchestrationsRequest struct {
	Limit  int `query:"limit" description:"Max results (default: 50)"`
	Offset int `query:"offset" description:"Results to skip"`
}

ListOrchestrationsRequest paginates orchestration configs.

type ListOrchestrationsResponse

type ListOrchestrationsResponse struct {
	Items []*orchestration.Config `json:"items"`
}

ListOrchestrationsResponse wraps a list of orchestration configs.

type ListPersonasRequest

type ListPersonasRequest struct {
	Limit  int `query:"limit"`
	Offset int `query:"offset"`
}

ListPersonasRequest is the request for listing personas.

type ListPersonasResponse

type ListPersonasResponse struct {
	Items []*persona.Persona `json:"items"`
}

ListPersonasResponse wraps a list of personas.

type ListRunsRequest

type ListRunsRequest struct {
	Limit  int `query:"limit"`
	Offset int `query:"offset"`
}

ListRunsRequest is the request for listing runs.

type ListRunsResponse

type ListRunsResponse struct {
	Items []*run.Run `json:"items"`
}

ListRunsResponse wraps a list of runs.

type ListSessionsRequest

type ListSessionsRequest struct {
	Name   string `path:"name" description:"Agent name"`
	Limit  int    `query:"limit"`
	Offset int    `query:"offset"`
}

ListSessionsRequest is the request for listing an agent's sessions.

type ListSessionsResponse

type ListSessionsResponse struct {
	Items []*session.Session `json:"items"`
}

ListSessionsResponse wraps a list of sessions.

type ListSkillsRequest

type ListSkillsRequest struct {
	Limit  int `query:"limit"`
	Offset int `query:"offset"`
}

ListSkillsRequest is the request for listing skills.

type ListSkillsResponse

type ListSkillsResponse struct {
	Items []*skill.Skill `json:"items"`
}

ListSkillsResponse wraps a list of skills.

type ListToolsRequest

type ListToolsRequest struct{}

ListToolsRequest is the request for listing available tools.

type ListToolsResponse

type ListToolsResponse struct {
	Items []ToolResponse `json:"items"`
}

ListToolsResponse wraps the engine's tool catalog.

type ListTraitsRequest

type ListTraitsRequest struct {
	Limit    int    `query:"limit"`
	Offset   int    `query:"offset"`
	Category string `query:"category" description:"Filter by category"`
}

ListTraitsRequest is the request for listing traits.

type ListTraitsResponse

type ListTraitsResponse struct {
	Items []*trait.Trait `json:"items"`
}

ListTraitsResponse wraps a list of traits.

type Operation added in v1.10.3

type Operation struct {
	// ID is the route's OpenAPI operation id, such as "resolveCheckpoint".
	ID string
	// Write is true when the route's method is not GET or HEAD.
	Write bool
}

Operation is one route of the module, as an Authorizer is asked about it.

type Option

type Option func(*API)

Option configures optional API services without starting background work.

func WithAuthorizer added in v1.10.3

func WithAuthorizer(a Authorizer) Option

WithAuthorizer guards every route with a and has resolveCheckpoint record the decider a names rather than the one the body asserts.

func WithOptimization

func WithOptimization(value *optimization.Optimizer) Option

WithOptimization exposes scoped operator workflows through the supplied service. The host supplies the optimizer's authenticated caller and current authorizer.

func WithPlanning

func WithPlanning(operator *coordination.PlanningOperator) Option

WithPlanning installs the shared current-authority team operator service.

type PlanningDetailRequest

type PlanningDetailRequest struct {
	ID string `path:"id"`
}

PlanningDetailRequest selects one immutable graph's current projection.

type PlanningListRequest

type PlanningListRequest struct {
	After string `query:"after" optional:"true"`
	Limit int    `query:"limit" optional:"true"`
}

PlanningListRequest selects bounded exact-scope plan metadata.

type PreviewPromptRequest

type PreviewPromptRequest struct {
	Name string `path:"name" description:"Agent name"`
}

PreviewPromptRequest is the request for previewing the computed system prompt.

type PreviewPromptResponse

type PreviewPromptResponse struct {
	Prompt string `json:"prompt"`
}

PreviewPromptResponse wraps the computed system prompt preview.

type ReplayRunRequest

type ReplayRunRequest struct {
	RunID string `path:"id" description:"Run ID"`
	After string `query:"after" optional:"true" description:"Opaque cursor from the previous replay page"`
	Limit int    `query:"limit" optional:"true" description:"Page size from 1 to 128; zero uses 128"`
}

ReplayRunRequest reads durable metadata with a run-bound cursor.

type ReplayStreamRequest

type ReplayStreamRequest struct {
	ReplayRunRequest
	LastEventID string `header:"Last-Event-ID" optional:"true" description:"Resume cursor from the last complete SSE page"`
}

ReplayStreamRequest resumes metadata through SSE. Last-Event-ID takes precedence over the initial query cursor when a browser reconnects to the same URL.

type ResolveCheckpointRequest

type ResolveCheckpointRequest struct {
	CheckpointID string `path:"id" description:"Checkpoint ID"`
	Decision     string `json:"decision" description:"approved or rejected"`
	// DecidedBy is the deciding person as the caller asserts it. With an
	// Authorizer installed it is ignored and the decider comes from
	// Authorizer.DecidedBy; without one it is recorded as sent.
	DecidedBy string `json:"decided_by,omitempty" description:"Deciding person; ignored when the host installs an authorizer"`
	// Reason is what a rejection puts on the failed run, so whoever finds
	// the run later reads why a person stopped it rather than a bare
	// "rejected".
	Reason string `json:"reason,omitempty" description:"Why the decision was made; recorded on the run when rejecting"`
}

ResolveCheckpointRequest is the request for resolving a checkpoint.

type ResultContentRequest

type ResultContentRequest struct {
	RunID    string `path:"id" description:"Run ID"`
	ResultID string `path:"result_id" description:"Committed result ID"`
}

ResultContentRequest selects a committed answer through current host policy.

type RunAgentRequest

type RunAgentRequest struct {
	Name      string          `path:"name" description:"Agent name"`
	Input     string          `json:"input" description:"User input"`
	Overrides *AgentOverrides `json:"overrides,omitempty" description:"Configuration overrides"`
}

RunAgentRequest is the request body for running an agent.

type RunAgentResponse

type RunAgentResponse struct {
	StopReason         string `json:"stop_reason,omitempty"`
	VerificationStatus string `json:"verification_status"`
	PublicationStatus  string `json:"publication_status"`
	ResultRef          string `json:"result_ref,omitempty"`
	RunID              string `json:"run_id"`
	Output             string `json:"output"`
	State              string `json:"state"`
	StepCount          int    `json:"step_count"`
	TokensUsed         int    `json:"tokens_used"`
	DurationMs         int64  `json:"duration_ms"`
}

RunAgentResponse wraps the result of a synchronous agent run.

type RunOrchestrationRequest

type RunOrchestrationRequest struct {
	Name  string `path:"name" description:"Orchestration name"`
	Input string `json:"input" description:"Initial input for the orchestration"`
}

RunOrchestrationRequest runs a stored orchestration by name.

type RunOrchestrationResponse

type RunOrchestrationResponse struct {
	RunID      string `json:"run_id"`
	Status     string `json:"status"`
	Strategy   string `json:"strategy"`
	Output     string `json:"output"`
	DurationMs int64  `json:"duration_ms"`
}

RunOrchestrationResponse summarizes a completed orchestration run.

type SendMessageRequest

type SendMessageRequest struct {
	Name           string `path:"name" description:"Recipient agent name"`
	From           string `` /* 139-byte string literal not displayed */
	Content        string `json:"content" description:"The message body"`
	Performative   string `json:"performative,omitempty" description:"FIPA-ACL speech act (default: inform)"`
	ConversationID string `json:"conversation_id,omitempty" description:"Continue an existing conversation"`
	InReplyTo      string `json:"in_reply_to,omitempty" description:"Reply-with token of the ask this answers"`
	Ontology       string `json:"ontology,omitempty" description:"Optional subject-matter label"`
}

SendMessageRequest injects a message from outside a run.

InReplyTo is what makes this more than an inbox write: a reply carrying the reply-with token of a waiting ask resumes the run behind it, which is how a person answers an agent that asked a question.

type SkillAssignmentReq

type SkillAssignmentReq struct {
	SkillName   string `json:"skill_name"`
	Proficiency string `json:"proficiency,omitempty"`
}

SkillAssignmentReq is the request representation of a skill assignment.

type StreamAgentRequest

type StreamAgentRequest struct {
	Name      string          `path:"name" description:"Agent name"`
	Input     string          `json:"input" description:"User input"`
	Overrides *AgentOverrides `json:"overrides,omitempty" description:"Configuration overrides"`
}

StreamAgentRequest is the request body for streaming an agent run.

type StreamEvent

type StreamEvent struct {
	Event string `json:"event"`
	Data  any    `json:"data"`
}

StreamEvent represents a single SSE event during agent streaming.

type ToolBindingReq

type ToolBindingReq struct {
	ToolName   string `json:"tool_name"`
	Mastery    string `json:"mastery,omitempty"`
	Guidance   string `json:"guidance,omitempty"`
	PreferWhen string `json:"prefer_when,omitempty"`
}

ToolBindingReq is the request representation of a tool binding.

type ToolResponse added in v1.10.3

type ToolResponse struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	// Kind is where the tool comes from: builtin, registered or external.
	Kind string `json:"kind" description:"builtin, registered or external"`
	// RetrySafe is whether the tool may run again after a crash.
	RetrySafe bool `json:"retry_safe"`
}

ToolResponse describes one tool in the catalog.

type TraitAssignmentReq

type TraitAssignmentReq struct {
	TraitName       string             `json:"trait_name"`
	DimensionValues map[string]float64 `json:"dimension_values,omitempty"`
}

TraitAssignmentReq is the request representation of a trait assignment.

type TriggerReq

type TriggerReq struct {
	Type    string `json:"type"`
	Pattern string `json:"pattern,omitempty"`
}

TriggerReq is the request representation of a behavior trigger.

type UpdateAgentRequest

type UpdateAgentRequest struct {
	Name            string         `path:"name" description:"Agent name"`
	Description     string         `json:"description,omitempty"`
	SystemPrompt    string         `json:"system_prompt,omitempty"`
	Model           string         `json:"model,omitempty"`
	Tools           []string       `json:"tools,omitempty"`
	MaxSteps        int            `json:"max_steps,omitempty"`
	MaxTokens       int            `json:"max_tokens,omitempty"`
	Temperature     float64        `json:"temperature,omitempty"`
	ReasoningLoop   string         `json:"reasoning_loop,omitempty"`
	PersonaRef      string         `json:"persona_ref,omitempty"`
	InlineSkills    []string       `json:"inline_skills,omitempty"`
	InlineTraits    []string       `json:"inline_traits,omitempty"`
	InlineBehaviors []string       `json:"inline_behaviors,omitempty"`
	Guardrails      map[string]any `json:"guardrails,omitempty"`
	Metadata        map[string]any `json:"metadata,omitempty"`
}

UpdateAgentRequest is the request body for updating an agent.

type UpdateBehaviorRequest

type UpdateBehaviorRequest struct {
	Name          string         `path:"name" description:"Behavior name"`
	Description   string         `json:"description,omitempty"`
	Triggers      []TriggerReq   `json:"triggers,omitempty"`
	Actions       []ActionReq    `json:"actions,omitempty"`
	Priority      int            `json:"priority,omitempty"`
	RequiresSkill string         `json:"requires_skill,omitempty"`
	RequiresTrait string         `json:"requires_trait,omitempty"`
	Metadata      map[string]any `json:"metadata,omitempty"`
}

UpdateBehaviorRequest is the request body for updating a behavior.

type UpdateConfigRequest

type UpdateConfigRequest struct {
	DefaultModel         string  `json:"default_model,omitempty"`
	DefaultMaxSteps      int     `json:"default_max_steps,omitempty"`
	DefaultMaxTokens     int     `json:"default_max_tokens,omitempty"`
	DefaultTemperature   float64 `json:"default_temperature,omitempty"`
	DefaultReasoningLoop string  `json:"default_reasoning_loop,omitempty"`
}

UpdateConfigRequest is the request body for updating engine configuration.

type UpdateOrchestrationRequest

type UpdateOrchestrationRequest struct {
	Name         string                      `path:"name" description:"Orchestration name"`
	Description  string                      `json:"description,omitempty"`
	Strategy     string                      `json:"strategy,omitempty"`
	Participants []orchestration.Participant `json:"participants,omitempty"`
	Settings     *orchestration.Settings     `json:"settings,omitempty"`
	Metadata     map[string]any              `json:"metadata,omitempty"`
}

UpdateOrchestrationRequest is the request body for updating an orchestration config.

type UpdatePersonaRequest

type UpdatePersonaRequest struct {
	Name               string               `path:"name" description:"Persona name"`
	Description        string               `json:"description,omitempty"`
	Identity           string               `json:"identity,omitempty"`
	Skills             []SkillAssignmentReq `json:"skills,omitempty"`
	Traits             []TraitAssignmentReq `json:"traits,omitempty"`
	Behaviors          []string             `json:"behaviors,omitempty"`
	CognitiveStyle     map[string]any       `json:"cognitive_style,omitempty"`
	CommunicationStyle map[string]any       `json:"communication_style,omitempty"`
	Perception         map[string]any       `json:"perception,omitempty"`
	Metadata           map[string]any       `json:"metadata,omitempty"`
}

UpdatePersonaRequest is the request body for updating a persona.

type UpdateSessionRequest

type UpdateSessionRequest struct {
	Name      string         `path:"name" description:"Agent name"`
	SessionID string         `path:"id" description:"Session ID"`
	Title     string         `json:"title,omitempty"`
	Metadata  map[string]any `json:"metadata,omitempty"`
}

UpdateSessionRequest is the request body for updating a session.

type UpdateSkillRequest

type UpdateSkillRequest struct {
	Name                 string            `path:"name" description:"Skill name"`
	Description          string            `json:"description,omitempty"`
	Tools                []ToolBindingReq  `json:"tools,omitempty"`
	Knowledge            []KnowledgeRefReq `json:"knowledge,omitempty"`
	SystemPromptFragment string            `json:"system_prompt_fragment,omitempty"`
	Dependencies         []string          `json:"dependencies,omitempty"`
	DefaultProficiency   string            `json:"default_proficiency,omitempty"`
	Metadata             map[string]any    `json:"metadata,omitempty"`
}

UpdateSkillRequest is the request body for updating a skill.

type UpdateTraitRequest

type UpdateTraitRequest struct {
	Name        string         `path:"name" description:"Trait name"`
	Description string         `json:"description,omitempty"`
	Dimensions  []DimensionReq `json:"dimensions,omitempty"`
	Influences  []InfluenceReq `json:"influences,omitempty"`
	Category    string         `json:"category,omitempty"`
	Metadata    map[string]any `json:"metadata,omitempty"`
}

UpdateTraitRequest is the request body for updating a trait.

type VerificationFailureResponse

type VerificationFailureResponse struct {
	Error   string                   `json:"error"`
	Code    int                      `json:"code"`
	Details *run.VerificationFailure `json:"details,omitempty"`
}

VerificationFailureResponse carries safe recovery metadata for a failed run. Details is optional because other conflicts can share the HTTP status code.

Jump to

Keyboard shortcuts

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