agent

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 20, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package agent provides interfaces and implementations for local and remote agents. Agents process content through callback handlers and can be registered with the controller.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent

type Agent interface {
	// Connect handles processing of input content.
	// It calls the output handler for each piece of content generated.
	// The handler may be called multiple times during processing.
	Connect(ctx context.Context, conversationID string, execID string, start *proto.AgentStart, e Executor, o OutputHandler) error

	// Close gracefully shuts down the agent and releases resources.
	Close() error
}

Agent defines the common interface for both local and remote agents. Agents process content using callback handlers.

type AgentInfo

type AgentInfo struct {
	ID          string
	Name        string
	Description string
	Metadata    map[string]string
}

AgentInfo contains metadata about a registered agent.

type Executor

type Executor interface {
	Exec(ctx context.Context, conversationID string, execID string, start *proto.AgentStart, o OutputHandler) (proto.State, error)
}

type LocalAgent

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

LocalAgent wraps a local (in-process) agent implementation. It implements the Agent interface for agents running in the same process as the controller.

func NewLocalAgent

func NewLocalAgent(config LocalAgentConfig) (*LocalAgent, error)

NewLocalAgent creates a new local agent with the provided configuration.

func (*LocalAgent) Close

func (a *LocalAgent) Close() error

Close gracefully shuts down the agent.

func (*LocalAgent) Connect

func (a *LocalAgent) Connect(ctx context.Context, conversationID string, execID string, start *proto.AgentStart, e Executor, o OutputHandler) error

Connect handles processing of input content with callback handler.

type LocalAgentConfig

type LocalAgentConfig struct {
	ProcessFunc func(ctx context.Context, conversationID string, execID string, start *proto.AgentStart, e Executor, o OutputHandler) error
}

LocalAgentConfig configures a local agent.

type OutputHandler

type OutputHandler func(outgoing *proto.AgentOutputs) error

OutputHandler is a callback function that handles output content from an agent. It is called for each piece of content the agent generates.

type RemoteAgent

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

RemoteAgent is a gRPC client that implements the Agent interface. It communicates with remote agent services over gRPC.

func NewRemoteAgent

func NewRemoteAgent(config RemoteAgentConfig) (*RemoteAgent, error)

NewRemoteAgent creates a new remote agent client.

func (*RemoteAgent) Close

func (a *RemoteAgent) Close() error

Close gracefully shuts down the remote agent connection.

func (*RemoteAgent) Connect

func (a *RemoteAgent) Connect(ctx context.Context, conversationID string, execID string, start *proto.AgentStart, e Executor, o OutputHandler) error

Connect handles processing of input content with the remote agent.

type RemoteAgentConfig

type RemoteAgentConfig struct {
	Address    string            // gRPC server address (e.g., "localhost:50051")
	Reconnect  bool              // Whether to automatically reconnect on failures
	MaxRetries int               // Maximum number of retry attempts (0 = infinite)
	DialOpts   []grpc.DialOption // gRPC dial options for customizing the connection
}

RemoteAgentConfig configures a remote agent client.

Jump to

Keyboard shortcuts

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