api

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package api provides the HTTP client for communicating with the Agentic Serving Layer daemon (RFC 5).

Package api provides the HTTP client for communicating with the Agentic Serving Layer daemon (RFC 5).

Package api provides the HTTP API for the Agentic Serving Layer daemon (RFC 5). The daemon is a control plane for coordination (shared context, cache policies, workflow execution). Actual inference happens on the LLM backends; the daemon coordinates state across multiple agents and LLM backends.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentExecuteRequest

type AgentExecuteRequest struct {
	ProfileName string          `json:"profile_name"`
	Prompt      string          `json:"prompt"`
	Messages    []model.Message `json:"messages,omitempty"` // Conversation history
	Tools       []*mcp.Tool     `json:"tools,omitempty"`    // Available tools (MCP format)
	MaxTokens   *int            `json:"max_tokens,omitempty"`
	Stream      bool            `json:"stream,omitempty"`
}

AgentExecuteRequest represents a request to execute an agent

type AgentExecuteResponse

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

AgentExecuteResponse represents the response from agent execution

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

func (*Client) StartWorkflow

func (c *Client) StartWorkflow(ctx context.Context, workflowName string) (*WorkflowStartResponse, error)

StartWorkflow starts a workflow execution

type CompleteTaskRequest

type CompleteTaskRequest struct {
	ExecutionID string          `json:"execution_id"`
	TaskIndex   int             `json:"task_index"`
	Response    *model.Response `json:"response,omitempty"`
}

CompleteTaskRequest represents a request to complete a task

type CompleteTaskResponse

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

CompleteTaskResponse represents the response from completing a task

type ContextSyncRequest

type ContextSyncRequest struct {
	ServerName string          `json:"server_name"`
	Messages   []model.Message `json:"messages"`
}

ContextSyncRequest represents a request to sync context

type ContextSyncResponse

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

ContextSyncResponse represents the response from context sync

type DaemonCoordinator

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

DaemonCoordinator handles communication with the daemon for coordination (shared context, workflow management). It does NOT proxy inference requests. Actual inference happens locally via providers; the daemon coordinates state.

func NewDaemonCoordinator

func NewDaemonCoordinator(daemonURL string) *DaemonCoordinator

NewDaemonCoordinator creates a new daemon coordinator

func (*DaemonCoordinator) CompleteTask

func (c *DaemonCoordinator) CompleteTask(ctx context.Context, executionID string, taskIndex int, response *model.Response) error

CompleteTask marks a task as complete and reports the response

func (*DaemonCoordinator) GetContext

func (c *DaemonCoordinator) GetContext(ctx context.Context, serverName string) ([]model.Message, error)

GetContext retrieves shared context from the daemon

func (*DaemonCoordinator) GetExecution

func (c *DaemonCoordinator) GetExecution(ctx context.Context, executionID string) (*serving.WorkflowExecution, error)

GetExecution retrieves workflow execution details from the daemon

func (*DaemonCoordinator) GetNextTask

func (c *DaemonCoordinator) GetNextTask(ctx context.Context, executionID string) (*config.WorkflowTask, int, bool, error)

GetNextTask retrieves the next task to execute from a workflow

func (*DaemonCoordinator) Health

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

Health checks daemon health

func (*DaemonCoordinator) StartWorkflow

func (c *DaemonCoordinator) StartWorkflow(ctx context.Context, workflowName string) (string, error)

StartWorkflow starts a workflow execution on the daemon

func (*DaemonCoordinator) SyncContext

func (c *DaemonCoordinator) SyncContext(ctx context.Context, serverName string, messages []model.Message) error

SyncContext syncs the local context with the daemon This is called after a task execution to share context updates

type ExecuteTaskRequest

type ExecuteTaskRequest struct {
	ExecutionID string                     `json:"execution_id"`
	TaskIndex   int                        `json:"task_index"`
	Prompt      string                     `json:"prompt"`
	Options     *ExecuteTaskRequestOptions `json:"options,omitempty"` // Optional; mirrors serving.ExecuteTaskOptions
}

ExecuteTaskRequest represents a request to execute a task

type ExecuteTaskRequestOptions added in v1.1.0

type ExecuteTaskRequestOptions struct {
	MaxTokens *int `json:"max_tokens,omitempty"` // Optional: maximum tokens to generate
	Stream    bool `json:"stream,omitempty"`     // If true, use streaming and populate response.metrics (ttft_ms, tpot_ms)
}

ExecuteTaskRequestOptions are optional parameters for task execution (mirrors serving.ExecuteTaskOptions).

type ExecuteTaskResponse

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

ExecuteTaskResponse represents the response from executing a task

type GetContextResponse

type GetContextResponse struct {
	Messages []model.Message `json:"messages"`
	Error    string          `json:"error,omitempty"`
}

GetContextResponse represents the response from get context

type GetExecutionResponse

type GetExecutionResponse struct {
	Execution *serving.WorkflowExecution `json:"execution,omitempty"`
	Error     string                     `json:"error,omitempty"`
}

GetExecutionResponse represents the response from get execution

type GetNextTaskResponse

type GetNextTaskResponse struct {
	Task      *config.WorkflowTask `json:"task,omitempty"`
	TaskIndex int                  `json:"task_index"`
	Complete  bool                 `json:"complete"`
	LLMServer string               `json:"llm_server,omitempty"` // Resolved server name (from profile or task override)
	Error     string               `json:"error,omitempty"`
}

GetNextTaskResponse represents the response from get next task

type Server

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

Server is the HTTP API server for the daemon

func NewServer

func NewServer(servingLayer serving.ServingLayer, listenAddress string) *Server

NewServer creates a new daemon API server

func (*Server) Shutdown

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

Shutdown gracefully shuts down the HTTP server

func (*Server) Start

func (s *Server) Start() error

Start starts the HTTP server

type WorkflowStartRequest

type WorkflowStartRequest struct {
	WorkflowName string `json:"workflow_name"`
}

WorkflowStartRequest represents a workflow start request

type WorkflowStartResponse

type WorkflowStartResponse struct {
	ExecutionID string `json:"execution_id"`
	Error       string `json:"error,omitempty"`
}

WorkflowStartResponse represents a workflow start response

Jump to

Keyboard shortcuts

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