client

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Copyright 2026 Teradata

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client wraps the gRPC Loom client with TUI-friendly methods.

func NewClient

func NewClient(cfg Config) (*Client, error)

NewClient creates a new Loom client.

func (*Client) AddMCPServer

AddMCPServer adds a new MCP server configuration.

func (*Client) AnswerClarificationQuestion

func (c *Client) AnswerClarificationQuestion(ctx context.Context, sessionID, questionID, answer, agentID string) error

AnswerClarificationQuestion provides an answer to a clarification question asked by an agent. This is used by the TUI to respond to EventQuestionAsked progress events.

func (*Client) AnswerClarificationQuestionWithRetry

func (c *Client) AnswerClarificationQuestionWithRetry(ctx context.Context, sessionID, questionID, answer, agentID string, maxRetries int) error

AnswerClarificationQuestionWithRetry sends an answer to a clarification question with retry logic. Retries up to maxRetries times with exponential backoff on transient failures. Useful for handling network issues and temporary server unavailability.

func (*Client) Close

func (c *Client) Close() error

Close closes the client connection.

func (*Client) CreatePattern

CreatePattern creates a new pattern at runtime for an agent.

func (*Client) CreateSession

func (c *Client) CreateSession(ctx context.Context, name string, agentID string) (*loomv1.Session, error)

CreateSession creates a new session.

func (*Client) DeleteArtifact

func (c *Client) DeleteArtifact(ctx context.Context, id string, hardDelete bool) error

DeleteArtifact deletes an artifact (soft or hard delete).

func (*Client) DeleteMCPServer

DeleteMCPServer removes an MCP server.

func (*Client) DeleteSession

func (c *Client) DeleteSession(ctx context.Context, sessionID string) error

DeleteSession deletes a session.

func (*Client) DeleteSharedMemory

DeleteSharedMemory removes a value from shared memory.

func (*Client) GetArtifact

func (c *Client) GetArtifact(ctx context.Context, id, name string) (*loomv1.Artifact, error)

GetArtifact retrieves artifact metadata by ID or name.

func (*Client) GetArtifactContent

func (c *Client) GetArtifactContent(ctx context.Context, id, encoding string, maxSizeMB int64) ([]byte, string, error)

GetArtifactContent reads artifact file content. The encoding parameter can be "text" or "base64" (auto-detected if empty). maxSizeMB limits the size of content that can be read (default: 10MB).

func (*Client) GetArtifactStats

func (c *Client) GetArtifactStats(ctx context.Context) (*loomv1.GetArtifactStatsResponse, error)

GetArtifactStats retrieves storage statistics.

func (*Client) GetConversationHistory

func (c *Client) GetConversationHistory(ctx context.Context, sessionID string) ([]*loomv1.Message, error)

GetConversationHistory retrieves conversation history for a session.

func (*Client) GetHealth

func (c *Client) GetHealth(ctx context.Context) (*loomv1.HealthStatus, error)

GetHealth checks server health.

func (*Client) GetMCPServer

func (c *Client) GetMCPServer(ctx context.Context, req *loomv1.GetMCPServerRequest) (*loomv1.MCPServerInfo, error)

GetMCPServer retrieves a specific MCP server.

func (*Client) GetSession

func (c *Client) GetSession(ctx context.Context, sessionID string) (*loomv1.Session, error)

GetSession retrieves a session.

func (*Client) GetSharedMemory

GetSharedMemory retrieves a value from shared memory.

func (*Client) GetSharedMemoryStats

func (c *Client) GetSharedMemoryStats(ctx context.Context, req *loomv1.GetSharedMemoryStatsRequest) (*loomv1.SharedMemoryStats, error)

GetSharedMemoryStats retrieves statistics for a namespace.

func (*Client) HealthCheckMCPServers

HealthCheckMCPServers checks health of all MCP servers.

func (*Client) ListAgents

func (c *Client) ListAgents(ctx context.Context) ([]*loomv1.AgentInfo, error)

ListAgents lists all available agents from the server.

func (*Client) ListArtifacts

func (c *Client) ListArtifacts(ctx context.Context, source, contentType string, tags []string, limit, offset int32, includeDeleted bool) ([]*loomv1.Artifact, int32, error)

ListArtifacts lists artifacts with optional filtering.

func (*Client) ListAvailableModels

func (c *Client) ListAvailableModels(ctx context.Context) ([]*loomv1.ModelInfo, error)

ListAvailableModels lists all available LLM models/providers.

func (*Client) ListMCPServerTools

func (c *Client) ListMCPServerTools(ctx context.Context, serverName string) ([]*loomv1.ToolDefinition, error)

ListMCPServerTools lists tools from a specific MCP server. This queries the MCP server directly through the manager, not the agent's tool registry.

func (*Client) ListMCPServers

ListMCPServers lists all configured MCP servers.

func (*Client) ListSessions

func (c *Client) ListSessions(ctx context.Context, limit, offset int32) ([]*loomv1.Session, error)

ListSessions lists all sessions.

func (*Client) ListSharedMemoryKeys

ListSharedMemoryKeys lists keys matching a pattern in a namespace.

func (*Client) ListTools

func (c *Client) ListTools(ctx context.Context) ([]*loomv1.ToolDefinition, error)

ListTools lists available tools.

func (*Client) ListToolsByBackend

func (c *Client) ListToolsByBackend(ctx context.Context, backend string) ([]*loomv1.ToolDefinition, error)

ListToolsByBackend lists tools filtered by backend/server name.

func (*Client) Publish

Publish publishes a message to a topic on the broadcast bus.

func (*Client) PutSharedMemory

PutSharedMemory writes or updates a value in shared memory.

func (*Client) RequestToolPermission

func (c *Client) RequestToolPermission(ctx context.Context, req *loomv1.ToolPermissionRequest) (*loomv1.ToolPermissionResponse, error)

RequestToolPermission requests user permission to execute a tool.

func (*Client) RestartMCPServer

func (c *Client) RestartMCPServer(ctx context.Context, req *loomv1.RestartMCPServerRequest) (*loomv1.MCPServerInfo, error)

RestartMCPServer restarts a running MCP server.

func (*Client) SearchArtifacts

func (c *Client) SearchArtifacts(ctx context.Context, query string, limit int32) ([]*loomv1.Artifact, error)

SearchArtifacts performs full-text search on artifacts.

func (*Client) SendAndReceive

SendAndReceive sends a message and waits for response (RPC-style).

func (*Client) SendAsync

SendAsync sends a message asynchronously (fire-and-forget).

func (*Client) ServerAddr

func (c *Client) ServerAddr() string

ServerAddr returns the server address.

func (*Client) StreamPatternUpdates

func (c *Client) StreamPatternUpdates(ctx context.Context, agentID, category string, eventFn func(*loomv1.PatternUpdateEvent)) error

StreamPatternUpdates streams pattern update events in real-time. The eventFn is called for each pattern update event (create, modify, delete). This call blocks until the context is cancelled or an error occurs.

func (*Client) StreamWeave

func (c *Client) StreamWeave(ctx context.Context, query string, sessionID string, agentID string, progressFn func(*loomv1.WeaveProgress)) error

StreamWeave sends a query and streams the response. The progressFn is called for each progress update.

func (*Client) Subscribe

func (c *Client) Subscribe(ctx context.Context, req *loomv1.SubscribeRequest, msgFn func(*loomv1.BusMessage)) error

Subscribe subscribes to messages on a topic pattern and streams them.

func (*Client) SubscribeToSession

func (c *Client) SubscribeToSession(ctx context.Context, sessionID string, agentID string, updateFn func(*loomv1.SessionUpdate)) error

SubscribeToSession subscribes to real-time updates for a session. Returns a stream that receives updates when new messages arrive. The updateFn is called for each session update.

func (*Client) SwitchModel

func (c *Client) SwitchModel(ctx context.Context, sessionID, provider, model string) (*loomv1.SwitchModelResponse, error)

SwitchModel switches the LLM model/provider for a session.

func (*Client) TestMCPServerConnection

TestMCPServerConnection tests an MCP server connection without persisting.

func (*Client) UpdateMCPServer

func (c *Client) UpdateMCPServer(ctx context.Context, req *loomv1.UpdateMCPServerRequest) (*loomv1.MCPServerInfo, error)

UpdateMCPServer updates an existing MCP server configuration.

func (*Client) UploadArtifact

func (c *Client) UploadArtifact(ctx context.Context, name string, content []byte, source, sourceAgentID, purpose string, tags []string) (*loomv1.Artifact, error)

UploadArtifact uploads a file to artifacts storage. Returns the created artifact metadata.

func (*Client) UploadArtifactFromFile

func (c *Client) UploadArtifactFromFile(ctx context.Context, filePath, purpose string, tags []string) (*loomv1.Artifact, error)

UploadArtifactFromFile reads a file and uploads it to artifacts storage. This is a convenience method that wraps UploadArtifact.

func (*Client) WatchSharedMemory

WatchSharedMemory watches for changes to keys and streams updates.

func (*Client) Weave

func (c *Client) Weave(ctx context.Context, query string, sessionID string, agentID string) (*loomv1.WeaveResponse, error)

Weave sends a query and returns the response.

type Config

type Config struct {
	ServerAddr string        // Default: localhost:9090
	Timeout    time.Duration // Default: 30s

	// TLS configuration
	TLSEnabled    bool   // Enable TLS connection
	TLSInsecure   bool   // Skip TLS certificate verification (for self-signed certs)
	TLSCAFile     string // Path to CA certificate file
	TLSServerName string // Override TLS server name (for testing)
}

Config holds client configuration.

Jump to

Keyboard shortcuts

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