Documentation
¶
Overview ¶
Package agent declares the building blocks for implement vet agent.
Index ¶
- func NewAgentUI(agent Agent, session Session, config AgentUIConfig) *agentUI
- func NewMcpClientToolBuilder(config McpClientToolBuilderConfig) (*mcpClientToolBuilder, error)
- func NewMockAgent() *mockAgent
- func NewMockSession() *mockSession
- func NewReactQueryAgent(model model.ToolCallingChatModel, config ReactQueryAgentConfig, ...) (*reactQueryAgent, error)
- func NewSession(memory Memory) (*session, error)
- func NewSimpleMemory() (*simpleMemory, error)
- func StartUI(agent Agent, session Session) error
- func StartUIWithConfig(agent Agent, session Session, config AgentUIConfig) error
- func WithTools(tools []tool.BaseTool) reactQueryAgentOpt
- type Agent
- type AgentExecutionContext
- type AgentExecutionContextOpt
- type AgentToolCallIntrospectionFn
- type AgentUIConfig
- type AnswerFormat
- type Input
- type McpClientToolBuilderConfig
- type Memory
- type Model
- type Output
- type ReactQueryAgentConfig
- type Session
- type ToolBuilder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewAgentUI ¶
func NewAgentUI(agent Agent, session Session, config AgentUIConfig) *agentUI
NewAgentUI creates a new agent UI instance
func NewMcpClientToolBuilder ¶
func NewMcpClientToolBuilder(config McpClientToolBuilderConfig) (*mcpClientToolBuilder, error)
NewMcpClientToolBuilder creates a new MCP client tool builder for `vet` MCP server. This basically connects to vet MCP server over SSE or executes the `vet server mcp` command to start a MCP server in stdio mode. We maintain loose coupling between the MCP client and the MCP server by allowing the client to be configured with a set of flags to enable/disable specific tools. We do this to ensure vet MCP contract is not violated and evolves independently. vet Agents will in turn depend on vet MCP server for data access.
func NewReactQueryAgent ¶
func NewReactQueryAgent(model model.ToolCallingChatModel, config ReactQueryAgentConfig, opts ...reactQueryAgentOpt, ) (*reactQueryAgent, error)
func NewSession ¶
func NewSimpleMemory ¶
func NewSimpleMemory() (*simpleMemory, error)
func StartUIWithConfig ¶
func StartUIWithConfig(agent Agent, session Session, config AgentUIConfig) error
StartUIWithConfig starts the TUI application with the provided configuration
Types ¶
type AgentExecutionContext ¶
type AgentExecutionContext struct {
// OnToolCall is called when the agent is about to call a tool.
// This is used for introspection only and not to mutate the agent's behavior.
OnToolCall func(context.Context, Session, Input, string, string) error
}
AgentExecutionContext is to pass additional context to the agent on a per execution basis. This is required so that an agent can be configured and shared with different components while allowing the component to pass additional context to the agent.
type AgentExecutionContextOpt ¶
type AgentExecutionContextOpt func(*AgentExecutionContext)
func WithToolCallHook ¶
type AgentToolCallIntrospectionFn ¶
AgentToolCallIntrospectionFn is a function that introspects a tool call. This is aligned with eino contract.
type AgentUIConfig ¶
type AgentUIConfig struct {
Width int
Height int
InitialSystemMessage string
TextInputPlaceholder string
TitleText string
MaxHistory int
// Only for informational purposes.
ModelName string
ModelVendor string
ModelFast bool
}
AgentUIConfig defines the configuration for the UI
func DefaultAgentUIConfig ¶
func DefaultAgentUIConfig() AgentUIConfig
DefaultAgentUIConfig returns the opinionated default configuration for the UI
type AnswerFormat ¶
type AnswerFormat string
const ( AnswerFormatMarkdown AnswerFormat = "markdown" AnswerFormatJSON AnswerFormat = "json" )
type McpClientToolBuilderConfig ¶
type McpClientToolBuilderConfig struct {
// Common config
ClientName string
ClientVersion string
// SSE client config
SseURL string
Headers map[string]string
// Stdout client config
SkipDefaultTools bool
SQLQueryToolEnabled bool
SQLQueryToolDBPath string
PackageRegistryToolEnabled bool
// Enable debug mode for the MCP client.
Debug bool
}
type Model ¶
type Model struct {
Vendor string
Name string
Fast bool
Client model.ToolCallingChatModel
}
func BuildModelFromEnvironment ¶
BuildModelFromEnvironment builds a model from the environment variables. The order of preference is: 1. OpenAI 2. Claude 3. Gemini 4. Others..
type Output ¶
type Output struct {
Answer string
Format AnswerFormat
}