Documentation
¶
Overview ¶
Package runtime provides protocol handlers for serving bond agents over A2A, HTTP, and MCP. Handlers are generic and configurable — use them directly for custom deployments, or use runtime/agentcore for AWS Bedrock AgentCore defaults.
Index ¶
- func DefaultAgentCard() *a2a.AgentCard
- func HandlePing(opts Options, w http.ResponseWriter, r *http.Request)
- func NewBondExecutor(agent bond.Agent, opts bond.AgentOptions) a2asrv.AgentExecutor
- type A2AHandler
- type A2AOptions
- type HTTPHandler
- type HTTPOptions
- type HealthStatus
- type MCPHandler
- type MCPOptions
- type Options
- type PingHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultAgentCard ¶
DefaultAgentCard returns a minimal agent card when none is configured.
func HandlePing ¶
func HandlePing(opts Options, w http.ResponseWriter, r *http.Request)
HandlePing writes a health check response.
func NewBondExecutor ¶
func NewBondExecutor(agent bond.Agent, opts bond.AgentOptions) a2asrv.AgentExecutor
NewBondExecutor creates the standard a2asrv.AgentExecutor that bridges a bond.Agent to the A2A protocol.
Types ¶
type A2AHandler ¶
type A2AHandler struct {
// contains filtered or unexported fields
}
A2AHandler serves the A2A protocol (JSON-RPC 2.0).
func NewA2AHandler ¶
func NewA2AHandler(agent bond.Agent, opts A2AOptions) *A2AHandler
NewA2AHandler creates an A2A handler wrapping a bond.Agent.
func NewA2AHandlerFromExecutor ¶
func NewA2AHandlerFromExecutor(executor a2asrv.AgentExecutor, opts A2AOptions) *A2AHandler
NewA2AHandlerFromExecutor creates an A2A handler from a custom executor.
func (*A2AHandler) ServeHTTP ¶
func (h *A2AHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implements http.Handler.
type A2AOptions ¶
type A2AOptions struct {
Options
// Port is the address to serve on (e.g. ":9000"). Used by Port() method.
Port string
// PingPath is the health check endpoint path. Defaults to "/ping".
PingPath string
}
A2AOptions configures the A2A handler.
type HTTPHandler ¶
type HTTPHandler struct {
// contains filtered or unexported fields
}
HTTPHandler serves a REST/SSE HTTP protocol.
func NewHTTPHandler ¶
func NewHTTPHandler(agent bond.Agent, opts HTTPOptions) *HTTPHandler
NewHTTPHandler creates an HTTP handler.
func (*HTTPHandler) ServeHTTP ¶
func (h *HTTPHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implements http.Handler.
type HTTPOptions ¶
type HTTPOptions struct {
Options
// Port is the address to serve on (e.g. ":8080").
Port string
// InvocationsPath is the endpoint path. Defaults to "/invocations".
InvocationsPath string
// PingPath is the health check endpoint path. Defaults to "/ping".
PingPath string
}
HTTPOptions configures the HTTP handler.
type HealthStatus ¶
type HealthStatus string
HealthStatus represents the health state of the agent.
const ( Healthy HealthStatus = "Healthy" HealthyBusy HealthStatus = "HealthyBusy" )
type MCPHandler ¶
type MCPHandler struct {
// contains filtered or unexported fields
}
MCPHandler serves the MCP protocol (streamable HTTP), exposing A2A operations as MCP tools.
func NewMCPHandler ¶
func NewMCPHandler(agent bond.Agent, opts MCPOptions) *MCPHandler
NewMCPHandler creates an MCP handler wrapping a bond.Agent.
func NewMCPHandlerFromExecutor ¶
func NewMCPHandlerFromExecutor(executor a2asrv.AgentExecutor, opts MCPOptions) *MCPHandler
NewMCPHandlerFromExecutor creates an MCP handler from a custom executor.
func (*MCPHandler) ServeHTTP ¶
func (h *MCPHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implements http.Handler.
type MCPOptions ¶
type MCPOptions struct {
Options
// Port is the address to serve on (e.g. ":8000").
Port string
// MCPPath is the MCP endpoint path. Defaults to "/mcp".
MCPPath string
// PingPath is the health check endpoint path. Defaults to "/ping".
PingPath string
// SSEMode enables Server-Sent Events transport. When true, the handler
// uses text/event-stream responses and emits observability log notifications
// during send_message execution.
// When false (default), uses application/json responses with no notifications.
SSEMode bool
}
MCPOptions configures the MCP handler.
type Options ¶
type Options struct {
// Card is the A2A agent card for discovery.
Card *a2a.AgentCard
// AgentOptions configures the bond loop (tools, plugins, max turns).
AgentOptions bond.AgentOptions
// Ping is an optional health check handler. If nil, returns Healthy.
Ping PingHandler
// A2AHandlerOptions are additional options passed to the a2asrv request handler.
A2AHandlerOptions []a2asrv.RequestHandlerOption
// Middleware wraps the primary protocol handler (optional).
Middleware func(http.Handler) http.Handler
}
Options is the shared configuration for all runtime handlers.
type PingHandler ¶
type PingHandler func(ctx context.Context) (HealthStatus, error)
PingHandler returns the current health status. Return an error to signal an unhealthy state (non-200 response).
Directories
¶
| Path | Synopsis |
|---|---|
|
Package acp provides an ACP (Agent Client Protocol) handler that serves bond agents over JSON-RPC 2.0 via stdio or other transports.
|
Package acp provides an ACP (Agent Client Protocol) handler that serves bond agents over JSON-RPC 2.0 via stdio or other transports. |
|
Package agentcore provides convenience constructors for running bond agents on AWS Bedrock AgentCore Runtime.
|
Package agentcore provides convenience constructors for running bond agents on AWS Bedrock AgentCore Runtime. |