agentcore

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package agentcore provides convenience constructors for running bond agents on AWS Bedrock AgentCore Runtime. It wraps the generic runtime package with AgentCore-specific defaults (ports, paths, session headers).

For custom deployments, use the runtime package directly.

Index

Constants

View Source
const (
	PortA2A  = ":9000"
	PortHTTP = ":8080"
	PortMCP  = ":8000"
)

Standard AgentCore ports.

View Source
const (
	// HeaderSessionID is the platform-injected session identifier.
	HeaderSessionID = "X-Amzn-Bedrock-AgentCore-Runtime-Session-Id"
	// HeaderCustomPrefix is the prefix for custom runtime headers.
	HeaderCustomPrefix = "X-Amzn-Bedrock-AgentCore-Runtime-Custom-"
)

Standard AgentCore runtime headers.

Variables

This section is empty.

Functions

func NewA2AHandler

func NewA2AHandler(agent bond.Agent, opts Options) *runtime.A2AHandler

NewA2AHandler creates an A2A handler with AgentCore defaults (port 9000, session middleware).

func NewA2AHandlerFromExecutor

func NewA2AHandlerFromExecutor(executor a2asrv.AgentExecutor, opts Options) *runtime.A2AHandler

NewA2AHandlerFromExecutor creates an A2A handler from a custom executor with AgentCore defaults.

func NewHTTPHandler

func NewHTTPHandler(agent bond.Agent, opts Options) *runtime.HTTPHandler

NewHTTPHandler creates an HTTP handler with AgentCore defaults (port 8080, /invocations path).

func NewMCPHandler

func NewMCPHandler(agent bond.Agent, opts Options) *runtime.MCPHandler

NewMCPHandler creates an MCP handler with AgentCore defaults (port 8000, /mcp path).

func NewMCPHandlerFromExecutor

func NewMCPHandlerFromExecutor(executor a2asrv.AgentExecutor, opts Options) *runtime.MCPHandler

NewMCPHandlerFromExecutor creates an MCP handler from a custom executor with AgentCore defaults.

func Serve

func Serve(agent bond.Agent, opts Options) error

Serve creates A2A, HTTP, and MCP handlers and serves them on their respective AgentCore ports. Blocks until SIGTERM/SIGINT is received, then performs graceful shutdown.

Types

type Options

type Options struct {
	runtime.Options
	// ShutdownTimeout is how long to wait for in-flight requests during graceful
	// shutdown. Defaults to 30 seconds if zero.
	ShutdownTimeout time.Duration
}

Options configures AgentCore handlers.

type Session

type Session struct {
	// SessionID is the platform-managed session identifier.
	SessionID string
	// Headers contains all request headers (for custom header access).
	Headers http.Header
}

Session holds AgentCore runtime metadata extracted from request headers.

func SessionFromContext

func SessionFromContext(ctx context.Context) *Session

SessionFromContext retrieves the AgentCore Session from ctx. Returns nil if not running inside an AgentCore handler.

func (*Session) CustomHeader

func (s *Session) CustomHeader(name string) string

CustomHeader returns the value of a custom AgentCore header by suffix. For example, CustomHeader("UserId") returns the value of "X-Amzn-Bedrock-AgentCore-Runtime-Custom-UserId".

func (*Session) Header

func (s *Session) Header(name string) string

Header returns the value of any request header by full name.

Jump to

Keyboard shortcuts

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