api

package
v1.2.15 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package api provides the HTTP API for the serving layer daemon.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessCheckRequest added in v1.2.15

type AccessCheckRequest struct {
	Tags       map[string]string `json:"tags"`
	Backend    string            `json:"backend,omitempty"`
	Tools      []string          `json:"tools,omitempty"`
	DataLabels []string          `json:"data_labels,omitempty"`
	SkillID    string            `json:"skill_id,omitempty"`
}

AccessCheckRequest is the request body for the access validation endpoint. Agents that manage their own inference can use this to check policies without executing.

type AccessCheckResponse added in v1.2.15

type AccessCheckResponse struct {
	Allowed bool   `json:"allowed"`
	Reason  string `json:"reason,omitempty"`
}

AccessCheckResponse is the response body for the access validation endpoint.

type AddPolicyRequest added in v1.2.13

type AddPolicyRequest struct {
	Name      string   `json:"name"`
	Subjects  []string `json:"subjects"`
	Resources []string `json:"resources"`
	Action    string   `json:"action"`
}

AddPolicyRequest is the request body for creating an access control policy.

type AgenticServer

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

AgenticServer is the HTTP API server for the daemon

func NewAgenticServer

func NewAgenticServer(layer *serving.AgenticLayer, listenAddress string, opts *ServerOptions) *AgenticServer

NewAgenticServer creates a new daemon API server.

func (*AgenticServer) Shutdown

func (s *AgenticServer) Shutdown(ctx context.Context) error

Shutdown gracefully shuts down the HTTP server

func (*AgenticServer) Start

func (s *AgenticServer) Start() error

Start starts the HTTP server

type Client

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

Client is the HTTP client for communicating with the daemon

func NewClient

func NewClient(baseURL string) *Client

NewClient creates a new daemon client

func (*Client) Health

func (c *Client) Health(ctx context.Context) error

Health checks the health of the daemon

type CostModelRequest added in v1.2.11

type CostModelRequest struct {
	InputCostPerMToken  float64 `json:"input_cost_per_mtoken"`
	OutputCostPerMToken float64 `json:"output_cost_per_mtoken"`
}

CostModelRequest is the JSON shape for per-backend token pricing.

type ExecuteRequest

type ExecuteRequest struct {
	Backend  string          `json:"backend"`
	StageID  string          `json:"stage_id,omitempty"`
	Prompt   string          `json:"prompt,omitempty"`
	Messages []model.Message `json:"messages,omitempty"`
	Tools    []*mcp.Tool     `json:"tools,omitempty"`
	model.InferenceOptions

	WorkflowID  string            `json:"workflow_id,omitempty"`
	CachePolicy string            `json:"cache_policy,omitempty"`
	Tags        map[string]string `json:"tags,omitempty"`
	DataLabels  []string          `json:"data_labels,omitempty"`
	SkillID     string            `json:"skill_id,omitempty"`
}

ExecuteRequest is the request body for the execute endpoint. Inference options (stream, max_tokens, temperature, top_p) are embedded so the JSON body stays flat.

type ExecuteResponse

type ExecuteResponse struct {
	Success  bool            `json:"success"`
	Response *model.Response `json:"response,omitempty"`
	Error    string          `json:"error,omitempty"`
}

ExecuteResponse is the response body for the execute endpoint.

type ListBackendsResponse

type ListBackendsResponse struct {
	Backends []string `json:"backends"`
}

ListBackendsResponse is the response body for list backends.

type ListPoliciesResponse added in v1.2.13

type ListPoliciesResponse struct {
	Policies []*access.Policy `json:"policies"`
}

ListPoliciesResponse is the response body for listing policies.

type ListSkillsResponse added in v1.2.15

type ListSkillsResponse struct {
	Skills []*core.SkillManifest `json:"skills"`
}

ListSkillsResponse is the response body for listing skills.

type RegisterBackendRequest

type RegisterBackendRequest struct {
	Name           string            `json:"name"`                      // backend name (used as "backend" in execute requests)
	Endpoint       string            `json:"endpoint"`                  // e.g. "http://vllm:8000/v1", "http://localhost:11434"
	Type           string            `json:"type"`                      // "openai" or "sglang"
	ModelID        string            `json:"model_id"`                  // full model identifier e.g. "openai:Qwen/Qwen3-4B-Instruct-2507", "openai:llama3"
	APIKeyEnvVar   string            `json:"api_key_env_var,omitempty"` // optional env var name for API key (for openai-type backends)
	MaxConcurrency *int              `json:"max_concurrency,omitempty"` // max concurrent requests (nil = default 1)
	QueueCapacity  *int              `json:"queue_capacity,omitempty"`  // max queued requests (nil = default 4096)
	CostModel      *CostModelRequest `json:"cost_model,omitempty"`      // optional token pricing
	Quality        *float64          `json:"quality,omitempty"`         // relative capability score in [0.0, 1.0]
}

RegisterBackendRequest is the request body for registering an LLM backend.

type RegisterBackendResponse

type RegisterBackendResponse struct {
	Success bool   `json:"success"`
	Error   string `json:"error,omitempty"`
}

RegisterBackendResponse is the response body for register backend.

type RegisterSkillRequest added in v1.2.15

type RegisterSkillRequest struct {
	Name             string   `json:"name"`
	RequiresBackends []string `json:"requires_backends"`
	RequiresTools    []string `json:"requires_tools,omitempty"`
	RequiresLabels   []string `json:"requires_labels,omitempty"`
}

RegisterSkillRequest is the request body for registering a skill manifest.

type RegisterWorkflowRequest added in v1.2.13

type RegisterWorkflowRequest struct {
	WorkflowID        string                          `json:"workflow_id"`
	Edges             []WorkflowEdgeEntry             `json:"edges"`
	Declassifications []WorkflowDeclassificationEntry `json:"declassifications,omitempty"`
}

RegisterWorkflowRequest is the request body for registering a workflow DAG.

type ServerOptions

type ServerOptions struct {
	// RateLimitRPS limits requests per second for execute and backends. 0 = disabled.
	RateLimitRPS int
}

ServerOptions configures the API server.

type WorkflowCompleteRequest

type WorkflowCompleteRequest struct {
	WorkflowID string   `json:"workflow_id"`
	Backends   []string `json:"backends"`
}

WorkflowCompleteRequest is the request body for the workflow/complete endpoint.

type WorkflowCompleteResponse

type WorkflowCompleteResponse struct {
	Success bool   `json:"success"`
	Error   string `json:"error,omitempty"`
}

WorkflowCompleteResponse is the response body for the workflow/complete endpoint.

type WorkflowDeclassificationEntry added in v1.2.13

type WorkflowDeclassificationEntry struct {
	StageID string   `json:"stage_id"`
	Labels  []string `json:"labels"`
}

WorkflowDeclassificationEntry declares which labels a stage strips from propagation.

type WorkflowEdgeEntry added in v1.2.13

type WorkflowEdgeEntry struct {
	From string `json:"from"`
	To   string `json:"to"`
}

WorkflowEdgeEntry is a single directed edge in the workflow DAG.

Jump to

Keyboard shortcuts

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