Documentation
¶
Index ¶
- Constants
- func BuiltinTools() []map[string]interface{}
- func GenerateRequestID() string
- func ParseSkillCall(params json.RawMessage) (string, string, map[string]interface{}, error)
- func ToolSchemaToMap(tool map[string]interface{}) map[string]interface{}
- type AgentInfo
- type Client
- func (c *Client) CallSkill(ctx context.Context, skillName string, params map[string]interface{}) (interface{}, error)
- func (c *Client) Connect(ctx context.Context) (*AgentInfo, error)
- func (c *Client) Disconnect() error
- func (c *Client) GetAgentInfo(ctx context.Context) (*AgentInfo, error)
- func (c *Client) GetSkills() map[string]Skill
- func (c *Client) IsConnected() bool
- func (c *Client) ListSkills(ctx context.Context) ([]Skill, error)
- func (c *Client) Ping(ctx context.Context) error
- func (c *Client) SendMessage(ctx context.Context, targetAgent string, content string) error
- func (c *Client) ShareMemory(ctx context.Context, item MemoryItem) error
- type ConnectionRequest
- type ConnectionResponse
- type HTTPTransport
- type Handler
- type HandlerFunc
- type JSONRPCError
- type JSONRPCRequest
- type JSONRPCResponse
- type ListResponse
- type Manager
- func (m *Manager) CallSkill(ctx context.Context, agentName string, skillName string, ...) (interface{}, error)
- func (m *Manager) Close() error
- func (m *Manager) Connect(name string, agentID string, transport Transport) error
- func (m *Manager) ConnectHTTP(name string, agentID string, baseURL string, headers map[string]string) error
- func (m *Manager) ConnectSSE(name string, agentID string, url string, headers map[string]string) error
- func (m *Manager) ConnectStdio(name string, agentID string, command string, args, env []string) error
- func (m *Manager) Disconnect(name string) error
- func (m *Manager) GetClient(name string) (*Client, error)
- func (m *Manager) GetServer(name string) (*Server, error)
- func (m *Manager) HealthCheck() map[string]bool
- func (m *Manager) ListAllSkills() []Skill
- func (m *Manager) ListConnected() []string
- func (m *Manager) ListConnectedAgents() []AgentInfo
- func (m *Manager) ListServers() []string
- func (m *Manager) Ping(ctx context.Context, name string) error
- func (m *Manager) StartServer(name string, agentID string, info AgentInfo, transport Transport) (*Server, error)
- func (m *Manager) StopServer(name string) error
- type MemoryItem
- type MemoryProvider
- type MemoryProviderInterface
- type Message
- type SSETransport
- type Server
- func (s *Server) GetAgentInfo() AgentInfo
- func (s *Server) IsRunning() bool
- func (s *Server) ListSkills() []Skill
- func (s *Server) RegisterHandler(method string, handler HandlerFunc)
- func (s *Server) RegisterSkill(skill Skill, handler HandlerFunc)
- func (s *Server) Start(ctx context.Context) error
- func (s *Server) Stop() error
- type ServerStub
- type Skill
- type SkillCallRequest
- type SkillCallResponse
- type StdioTransport
- type TCPTransport
- func (t *TCPTransport) Close() error
- func (t *TCPTransport) Connect(ctx context.Context) error
- func (t *TCPTransport) IsConnected() bool
- func (t *TCPTransport) Listen(ctx context.Context) error
- func (t *TCPTransport) Receive(ctx context.Context) (*JSONRPCRequest, error)
- func (t *TCPTransport) Send(ctx context.Context, req *JSONRPCRequest) (*JSONRPCResponse, error)
- type ToolAdapter
- type Transport
- type TransportConfig
- type TransportType
Constants ¶
const ( ProtocolVersion = "1.0" JSONRPCVersion = "2.0" )
Protocol version constants
const ( ErrCodeParseError = -32700 ErrCodeInvalidRequest = -32600 ErrCodeMethodNotFound = -32601 ErrCodeInvalidParams = -32602 ErrCodeInternalError = -32603 ErrCodeServerError = -32000 ErrCodeConnectionFailed = -32002 )
Error codes for ACP
Variables ¶
This section is empty.
Functions ¶
func BuiltinTools ¶
func BuiltinTools() []map[string]interface{}
BuiltinTools returns the list of built-in ACP tools
func GenerateRequestID ¶
func GenerateRequestID() string
GenerateRequestID generates a new request ID
func ParseSkillCall ¶
ParseSkillCall parses a skill call request
func ToolSchemaToMap ¶
ToolSchemaToMap converts a tool schema to map format used by agent
Types ¶
type AgentInfo ¶
type AgentInfo struct {
ID string `json:"id"`
Name string `json:"name"`
Version string `json:"version"`
Capabilities []string `json:"capabilities"`
Metadata map[string]string `json:"metadata,omitempty"`
}
AgentInfo represents information about an agent
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents an ACP client for connecting to other agents
func NewClientWithTimeout ¶
NewClientWithTimeout creates a new ACP client with custom timeout
func (*Client) CallSkill ¶
func (c *Client) CallSkill(ctx context.Context, skillName string, params map[string]interface{}) (interface{}, error)
CallSkill calls a skill on the connected agent
func (*Client) Disconnect ¶
Disconnect disconnects from the ACP server
func (*Client) GetAgentInfo ¶
GetAgentInfo returns information about the connected agent
func (*Client) IsConnected ¶
IsConnected returns whether the client is connected
func (*Client) ListSkills ¶
ListSkills lists all available skills from the connected agent
func (*Client) SendMessage ¶
SendMessage sends a message to another agent (via connected agent)
func (*Client) ShareMemory ¶
func (c *Client) ShareMemory(ctx context.Context, item MemoryItem) error
ShareMemory shares a memory item with the connected agent
type ConnectionRequest ¶
type ConnectionRequest struct {
AgentID string `json:"agentId"`
AgentInfo AgentInfo `json:"agentInfo"`
Capabilities []string `json:"capabilities"`
Skills []Skill `json:"skills"`
}
ConnectionRequest is sent when connecting to an agent
type ConnectionResponse ¶
type ConnectionResponse struct {
Success bool `json:"success"`
AgentInfo AgentInfo `json:"agentInfo,omitempty"`
Capabilities []string `json:"capabilities,omitempty"`
Skills []Skill `json:"skills,omitempty"`
Error string `json:"error,omitempty"`
}
ConnectionResponse is returned after a successful connection
type HTTPTransport ¶
type HTTPTransport struct {
// contains filtered or unexported fields
}
HTTPTransport implements ACP transport over HTTP
func NewHTTPTransport ¶
func NewHTTPTransport(baseURL string, headers map[string]string) *HTTPTransport
NewHTTPTransport creates a new HTTP transport
func (*HTTPTransport) Close ¶
func (t *HTTPTransport) Close() error
Close closes the HTTP transport (no-op)
func (*HTTPTransport) Receive ¶
func (t *HTTPTransport) Receive(ctx context.Context) (*JSONRPCRequest, error)
Receive receives a JSON-RPC request (not applicable for HTTP)
func (*HTTPTransport) Respond ¶
func (t *HTTPTransport) Respond(ctx context.Context, resp *JSONRPCResponse) error
Respond sends a JSON-RPC response (no-op for HTTP transport)
func (*HTTPTransport) Send ¶
func (t *HTTPTransport) Send(ctx context.Context, req *JSONRPCRequest) (*JSONRPCResponse, error)
Send sends a JSON-RPC request and returns the response
type Handler ¶
type Handler = HandlerFunc
HandlerFunc is the function signature for ACP method handlers (documented in server.go)
type HandlerFunc ¶
type HandlerFunc func(ctx context.Context, params json.RawMessage) (interface{}, error)
HandlerFunc is the function signature for ACP method handlers
type JSONRPCError ¶
type JSONRPCError struct {
Code int `json:"code"`
Message string `json:"message"`
Data json.RawMessage `json:"data,omitempty"`
}
JSONRPCError represents a JSON-RPC 2.0 error
func (*JSONRPCError) Error ¶
func (e *JSONRPCError) Error() string
Error implements the error interface
type JSONRPCRequest ¶
type JSONRPCRequest struct {
JSONRPC string `json:"jsonrpc"`
Method string `json:"method"`
Params json.RawMessage `json:"params,omitempty"`
ID interface{} `json:"id,omitempty"`
}
JSONRPCRequest represents a JSON-RPC 2.0 request
func NewJSONRPCRequest ¶
func NewJSONRPCRequest(method string, params interface{}, id interface{}) *JSONRPCRequest
NewJSONRPCRequest creates a new JSON-RPC request
type JSONRPCResponse ¶
type JSONRPCResponse struct {
JSONRPC string `json:"jsonrpc"`
Result json.RawMessage `json:"result,omitempty"`
Error *JSONRPCError `json:"error,omitempty"`
ID interface{} `json:"id,omitempty"`
}
JSONRPCResponse represents a JSON-RPC 2.0 response
func NewJSONRPCError ¶
func NewJSONRPCError(id interface{}, code int, message string) *JSONRPCResponse
NewJSONRPCError creates a new JSON-RPC error response
func NewJSONRPCResponse ¶
func NewJSONRPCResponse(id interface{}, result interface{}) *JSONRPCResponse
NewJSONRPCResponse creates a new JSON-RPC response
type ListResponse ¶
type ListResponse struct {
Items []interface{} `json:"items"`
Count int `json:"count"`
}
ListResponse wraps a list result
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manages multiple ACP connections (servers and clients)
func (*Manager) CallSkill ¶
func (m *Manager) CallSkill(ctx context.Context, agentName string, skillName string, params map[string]interface{}) (interface{}, error)
CallSkill calls a skill on a connected agent
func (*Manager) ConnectHTTP ¶
func (m *Manager) ConnectHTTP(name string, agentID string, baseURL string, headers map[string]string) error
ConnectHTTP connects to an ACP agent using HTTP transport
func (*Manager) ConnectSSE ¶
func (m *Manager) ConnectSSE(name string, agentID string, url string, headers map[string]string) error
ConnectSSE connects to an ACP agent using SSE transport
func (*Manager) ConnectStdio ¶
func (m *Manager) ConnectStdio(name string, agentID string, command string, args, env []string) error
ConnectStdio connects to an ACP agent using stdio transport
func (*Manager) Disconnect ¶
Disconnect disconnects from an ACP agent
func (*Manager) HealthCheck ¶
HealthCheck checks health of all connections
func (*Manager) ListAllSkills ¶
ListAllSkills lists all skills from all connected agents
func (*Manager) ListConnected ¶
ListConnected lists all connected agent names
func (*Manager) ListConnectedAgents ¶
ListConnectedAgents returns detailed info about all connected agents
func (*Manager) ListServers ¶
ListServers lists all running servers
func (*Manager) StartServer ¶
func (m *Manager) StartServer(name string, agentID string, info AgentInfo, transport Transport) (*Server, error)
StartServer starts an ACP server
func (*Manager) StopServer ¶
StopServer stops an ACP server
type MemoryItem ¶
type MemoryItem struct {
ID string `json:"id"`
Content string `json:"content"`
Type string `json:"type"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
MemoryItem represents a shared memory entry
type MemoryProvider ¶
type MemoryProvider interface {
GetMemory(ctx context.Context, query string) ([]MemoryItem, error)
}
MemoryProvider interface for providing memory to other agents
type MemoryProviderInterface ¶
type MemoryProviderInterface = MemoryProvider
MemoryProvider is the interface for memory providers (documented in server.go)
type Message ¶
type Message struct {
ID string `json:"id"`
From string `json:"from"`
To string `json:"to"`
Content string `json:"content"`
Type string `json:"type"`
Timestamp int64 `json:"timestamp"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
Message represents a message between agents
type SSETransport ¶
type SSETransport struct {
// contains filtered or unexported fields
}
SSETransport implements ACP transport over Server-Sent Events
func NewSSETransport ¶
func NewSSETransport(url string, headers map[string]string) (*SSETransport, error)
NewSSETransport creates a new SSE transport
func (*SSETransport) Receive ¶
func (t *SSETransport) Receive(ctx context.Context) (*JSONRPCRequest, error)
Receive receives a JSON-RPC request via SSE (for inbound requests)
func (*SSETransport) Respond ¶
func (t *SSETransport) Respond(ctx context.Context, resp *JSONRPCResponse) error
Respond sends a JSON-RPC response (no-op for SSE transport)
func (*SSETransport) Send ¶
func (t *SSETransport) Send(ctx context.Context, req *JSONRPCRequest) (*JSONRPCResponse, error)
Send sends a JSON-RPC request and returns the response
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server represents an ACP server that exposes agent capabilities
func NewACPServer ¶
NewServer creates a new ACP server (alias for backward compatibility)
func NewServerWithTransport ¶
NewServerWithTransport creates a new ACP server with a specific transport
func (*Server) GetAgentInfo ¶
GetAgentInfo returns the agent info
func (*Server) ListSkills ¶
ListSkills returns all registered skills
func (*Server) RegisterHandler ¶
func (s *Server) RegisterHandler(method string, handler HandlerFunc)
RegisterHandler registers a custom method handler
func (*Server) RegisterSkill ¶
func (s *Server) RegisterSkill(skill Skill, handler HandlerFunc)
RegisterSkill registers a skill with the server
type ServerStub ¶
type ServerStub = Server
Server represents an ACP server (alias for backward compatibility)
type Skill ¶
type Skill struct {
Name string `json:"name"`
Description string `json:"description"`
InputSchema map[string]interface{} `json:"inputSchema"`
Source string `json:"source,omitempty"`
}
Skill represents an agent skill/capability
type SkillCallRequest ¶
type SkillCallRequest struct {
SkillName string `json:"skillName"`
Params map[string]interface{} `json:"params,omitempty"`
}
SkillCallRequest represents a request to call a skill
type SkillCallResponse ¶
type SkillCallResponse struct {
Success bool `json:"success"`
Result json.RawMessage `json:"result,omitempty"`
Error string `json:"error,omitempty"`
Output map[string]interface{} `json:"output,omitempty"`
}
SkillCallResponse represents the result of a skill call
type StdioTransport ¶
type StdioTransport struct {
// contains filtered or unexported fields
}
StdioTransport implements ACP transport over stdio
func NewStdioTransport ¶
func NewStdioTransport(command string, args, env []string) (*StdioTransport, error)
NewStdioTransport creates a new stdio transport
func NewStdioTransportFromProcess ¶
func NewStdioTransportFromProcess(cmd *exec.Cmd) (*StdioTransport, error)
NewStdioTransportFromProcess creates a stdio transport from an existing process
func (*StdioTransport) Close ¶
func (t *StdioTransport) Close() error
Close closes the stdio transport
func (*StdioTransport) Receive ¶
func (t *StdioTransport) Receive(ctx context.Context) (*JSONRPCRequest, error)
Receive receives a JSON-RPC request (blocking)
func (*StdioTransport) Respond ¶
func (t *StdioTransport) Respond(ctx context.Context, resp *JSONRPCResponse) error
Respond sends a JSON-RPC response (for server-side use)
func (*StdioTransport) Send ¶
func (t *StdioTransport) Send(ctx context.Context, req *JSONRPCRequest) (*JSONRPCResponse, error)
Send sends a JSON-RPC response
type TCPTransport ¶
type TCPTransport struct {
// contains filtered or unexported fields
}
TCPTransport implements ACP transport over TCP
func NewTCPTransport ¶
func NewTCPTransport(address string) (*TCPTransport, error)
NewTCPTransport creates a new TCP transport client
func NewTCPTransportAsServer ¶
func NewTCPTransportAsServer(address string) (*TCPTransport, error)
NewTCPTransportAsServer creates a new TCP transport server
func (*TCPTransport) Connect ¶
func (t *TCPTransport) Connect(ctx context.Context) error
Connect establishes the TCP connection
func (*TCPTransport) IsConnected ¶
func (t *TCPTransport) IsConnected() bool
IsConnected checks if the TCP connection is alive
func (*TCPTransport) Listen ¶
func (t *TCPTransport) Listen(ctx context.Context) error
Listen starts the TCP server
func (*TCPTransport) Receive ¶
func (t *TCPTransport) Receive(ctx context.Context) (*JSONRPCRequest, error)
Receive receives a JSON-RPC request
func (*TCPTransport) Send ¶
func (t *TCPTransport) Send(ctx context.Context, req *JSONRPCRequest) (*JSONRPCResponse, error)
Send sends a JSON-RPC request
type ToolAdapter ¶
type ToolAdapter struct {
// contains filtered or unexported fields
}
ToolAdapter adapts ACP client operations to tool interface
func NewToolAdapter ¶
func NewToolAdapter(manager *Manager) *ToolAdapter
NewToolAdapter creates a new tool adapter for ACP
type Transport ¶
type Transport interface {
Send(ctx context.Context, req *JSONRPCRequest) (*JSONRPCResponse, error)
Receive(ctx context.Context) (*JSONRPCRequest, error)
Respond(ctx context.Context, resp *JSONRPCResponse) error
Close() error
}
Transport interface for ACP transport layers
type TransportConfig ¶
type TransportConfig struct {
Type TransportType `json:"type"`
Address string `json:"address,omitempty"`
Command string `json:"command,omitempty"`
Args []string `json:"args,omitempty"`
Env []string `json:"env,omitempty"`
BaseURL string `json:"baseURL,omitempty"`
Headers map[string]string `json:"headers,omitempty"`
}
TransportConfig holds transport configuration
type TransportType ¶
type TransportType string
TransportType represents the type of transport
const ( TransportStdio TransportType = "stdio" TransportHTTP TransportType = "http" TransportSSE TransportType = "sse" TransportTCP TransportType = "tcp" )