Documentation
¶
Overview ¶
Package agentclient provides a lightweight HTTP client for querying the klaus agent's /status endpoint. Unlike the MCP client, this does not require session initialization — it's a simple GET request.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StreamCompletion ¶
func StreamCompletion(ctx context.Context, client *http.Client, baseURL, prompt string) (<-chan CompletionDelta, error)
StreamCompletion sends a prompt via POST /v1/chat/completions with stream=true and returns a channel of deltas. The channel is closed when the stream ends (either cleanly via [DONE] or due to an error).
Types ¶
type AgentInfo ¶
type AgentInfo struct {
Status string `json:"status"`
SessionID string `json:"session_id,omitempty"`
MessageCount int `json:"message_count,omitempty"`
}
AgentInfo holds the agent-level fields returned by the /status endpoint.
type CompletionDelta ¶
CompletionDelta is a single streaming delta from the completions endpoint. When the channel is closed the stream has ended. If the stream was interrupted by an I/O error (as opposed to a clean [DONE] or context cancellation), Err is set on the final delta before the channel closes.
type StatusResponse ¶
type StatusResponse struct {
Name string `json:"name"`
Version string `json:"version"`
Agent AgentInfo `json:"agent"`
Mode string `json:"mode,omitempty"`
}
StatusResponse represents the JSON body returned by GET /status.
func FetchStatus ¶
FetchStatus queries the agent's HTTP /status endpoint and returns the parsed response. Returns an error if the agent is unreachable, returns a non-200 status, or returns invalid JSON.