agentcore

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package agentcore provides AWS CDK constructs for AgentCore deployments.

Index

Constants

This section is empty.

Variables

View Source
var (
	// LoadStackConfigFromFile loads a StackConfig from a JSON or YAML file.
	LoadStackConfigFromFile = iac.LoadStackConfigFromFile

	// LoadStackConfigFromJSON parses a StackConfig from JSON data.
	LoadStackConfigFromJSON = iac.LoadStackConfigFromJSON

	// LoadStackConfigFromYAML parses a StackConfig from YAML data.
	LoadStackConfigFromYAML = iac.LoadStackConfigFromYAML

	// JSONConfigExample returns an example JSON configuration.
	JSONConfigExample = iac.JSONConfigExample

	// YAMLConfigExample returns an example YAML configuration.
	YAMLConfigExample = iac.YAMLConfigExample

	// WriteExampleConfig writes an example configuration file.
	WriteExampleConfig = iac.WriteExampleConfig

	// GenerateCloudFormation generates a CloudFormation template from StackConfig.
	GenerateCloudFormation = iac.GenerateCloudFormation

	// GenerateCloudFormationFile generates a CloudFormation template and writes it to a file.
	GenerateCloudFormationFile = iac.GenerateCloudFormationFile

	// GenerateCloudFormationFromFile loads a config file and generates CloudFormation.
	GenerateCloudFormationFromFile = iac.GenerateCloudFormationFromFile
)

Re-export config loading functions from agentkit for convenience.

View Source
var (
	DefaultAgentConfig          = iac.DefaultAgentConfig
	DefaultVPCConfig            = iac.DefaultVPCConfig
	DefaultObservabilityConfig  = iac.DefaultObservabilityConfig
	DefaultIAMConfig            = iac.DefaultIAMConfig
	ValidMemoryValues           = iac.ValidMemoryValues
	ValidObservabilityProviders = iac.ValidObservabilityProviders
)

Re-export default config functions from agentkit.

Functions

func NewApp

func NewApp() awscdk.App

NewApp creates a new CDK app with common settings.

func Synth

func Synth(app awscdk.App)

Synth synthesizes the CDK app to CloudFormation templates.

Types

type AgentBuilder

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

AgentBuilder provides a fluent interface for building agent configurations.

func NewAgentBuilder

func NewAgentBuilder(name, containerImage string) *AgentBuilder

NewAgentBuilder creates a new agent builder.

func (*AgentBuilder) AsDefault

func (b *AgentBuilder) AsDefault() *AgentBuilder

AsDefault marks this agent as the default.

func (*AgentBuilder) Build

func (b *AgentBuilder) Build() AgentConfig

Build returns the agent configuration.

func (*AgentBuilder) WithDescription

func (b *AgentBuilder) WithDescription(description string) *AgentBuilder

WithDescription sets the agent description.

func (*AgentBuilder) WithEnvVar

func (b *AgentBuilder) WithEnvVar(key, value string) *AgentBuilder

WithEnvVar adds a single environment variable.

func (*AgentBuilder) WithEnvironment

func (b *AgentBuilder) WithEnvironment(env map[string]string) *AgentBuilder

WithEnvironment sets environment variables.

func (*AgentBuilder) WithMemory

func (b *AgentBuilder) WithMemory(memoryMB int) *AgentBuilder

WithMemory sets the memory allocation in MB.

func (*AgentBuilder) WithSecrets

func (b *AgentBuilder) WithSecrets(secretARNs ...string) *AgentBuilder

WithSecrets adds secret ARNs.

func (*AgentBuilder) WithTimeout

func (b *AgentBuilder) WithTimeout(timeoutSeconds int) *AgentBuilder

WithTimeout sets the timeout in seconds.

type AgentConfig

type AgentConfig = iac.AgentConfig

Type aliases for convenience - re-export from agentkit.

type AgentConstruct

type AgentConstruct struct {
	constructs.Construct

	// Name is the agent name.
	Name string

	// Config is the agent configuration.
	Config AgentConfig

	// ARN is the agent ARN (available after deployment).
	ARN *string

	// InvokeURL is the agent invocation URL.
	InvokeURL *string
}

AgentConstruct represents a single AgentCore agent.

type AgentCoreStack

type AgentCoreStack struct {
	awscdk.Stack

	// Config is the stack configuration.
	Config StackConfig

	// VPC is the VPC used by the agents.
	VPC awsec2.IVpc

	// SecurityGroup is the security group for agent communication.
	SecurityGroup awsec2.ISecurityGroup

	// ExecutionRole is the IAM role used by agents.
	ExecutionRole awsiam.IRole

	// Secret is the Secrets Manager secret containing API keys.
	Secret awssecretsmanager.ISecret

	// LogGroup is the CloudWatch log group for agent logs.
	LogGroup awslogs.ILogGroup

	// Agents contains the created agent constructs.
	Agents map[string]*AgentConstruct

	// Runtimes contains the AgentCore runtime resources.
	Runtimes map[string]awsbedrockagentcore.CfnRuntime

	// Endpoints contains the AgentCore runtime endpoint resources.
	Endpoints map[string]awsbedrockagentcore.CfnRuntimeEndpoint

	// Gateway is the multi-agent routing gateway (if enabled).
	Gateway awsbedrockagentcore.CfnGateway
}

AgentCoreStack is a CDK stack that deploys agents to AWS Bedrock AgentCore.

func MustNewStackFromFile

func MustNewStackFromFile(scope constructs.Construct, configPath string) *AgentCoreStack

MustNewStackFromFile is like NewStackFromFile but panics on error.

func NewAgentCoreStack

func NewAgentCoreStack(scope constructs.Construct, id string, config StackConfig) *AgentCoreStack

NewAgentCoreStack creates a new AgentCore CDK stack.

func NewStackFromFile

func NewStackFromFile(scope constructs.Construct, configPath string) (*AgentCoreStack, error)

NewStackFromFile creates an AgentCoreStack from a JSON or YAML config file. This is the simplest way to deploy - just provide a config file.

func NewStackFromJSON

func NewStackFromJSON(scope constructs.Construct, jsonData []byte) (*AgentCoreStack, error)

NewStackFromJSON creates an AgentCoreStack from JSON data.

func NewStackFromYAML

func NewStackFromYAML(scope constructs.Construct, yamlData []byte) (*AgentCoreStack, error)

NewStackFromYAML creates an AgentCoreStack from YAML data.

type AuthorizerConfig

type AuthorizerConfig = iac.AuthorizerConfig

Type aliases for convenience - re-export from agentkit.

type CfnIncludeBuilder

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

CfnIncludeBuilder provides a fluent interface for building CfnInclude stacks.

func NewCfnIncludeBuilder

func NewCfnIncludeBuilder(stackName, templateFile string) *CfnIncludeBuilder

NewCfnIncludeBuilder creates a new CfnInclude builder.

func (*CfnIncludeBuilder) Build

Build creates the CfnInclude stack.

func (*CfnIncludeBuilder) WithParameter

func (b *CfnIncludeBuilder) WithParameter(name, value string) *CfnIncludeBuilder

WithParameter adds a parameter override.

func (*CfnIncludeBuilder) WithParameters

func (b *CfnIncludeBuilder) WithParameters(params map[string]string) *CfnIncludeBuilder

WithParameters adds multiple parameter overrides.

func (*CfnIncludeBuilder) WithPreserveLogicalIds

func (b *CfnIncludeBuilder) WithPreserveLogicalIds(preserve bool) *CfnIncludeBuilder

WithPreserveLogicalIds sets whether to preserve logical IDs.

func (*CfnIncludeBuilder) WithTag

func (b *CfnIncludeBuilder) WithTag(key, value string) *CfnIncludeBuilder

WithTag adds a tag.

func (*CfnIncludeBuilder) WithTags

func (b *CfnIncludeBuilder) WithTags(tags map[string]string) *CfnIncludeBuilder

WithTags adds multiple tags.

type CfnIncludeConfig

type CfnIncludeConfig struct {
	// StackName is the CloudFormation stack name.
	StackName string

	// TemplateFile is the path to the CloudFormation template file.
	// Supports JSON or YAML format.
	TemplateFile string

	// Parameters are CloudFormation parameter overrides.
	// Keys are parameter names, values are the override values.
	Parameters map[string]string

	// PreserveLogicalIds keeps the original logical IDs from the template.
	// Default: true (recommended for importing existing stacks)
	PreserveLogicalIds bool

	// Tags are AWS resource tags applied to all resources.
	Tags map[string]string
}

CfnIncludeConfig configures the CfnInclude stack.

type CfnIncludeStack

type CfnIncludeStack struct {
	awscdk.Stack

	// Template is the included CloudFormation template.
	Template cloudformationinclude.CfnInclude
}

CfnIncludeStack wraps an existing CloudFormation template with CDK. This allows using existing CF templates while benefiting from CDK's deployment tooling and the ability to add CDK constructs on top.

func NewCfnIncludeStack

func NewCfnIncludeStack(scope constructs.Construct, config CfnIncludeConfig) *CfnIncludeStack

NewCfnIncludeStack creates a CDK stack that wraps an existing CloudFormation template.

This approach is useful when:

  • You have existing CloudFormation templates you want to keep using
  • You want to gradually migrate from CloudFormation to CDK
  • You need to import an existing CloudFormation stack

Example:

app := agentcore.NewApp()
stack := agentcore.NewCfnIncludeStack(app, agentcore.CfnIncludeConfig{
    StackName:    "my-agents",
    TemplateFile: "agentcore-stack.yaml",
    Parameters: map[string]string{
        "Environment": "production",
    },
})
agentcore.Synth(app)

func (*CfnIncludeStack) GetNestedStack

func (s *CfnIncludeStack) GetNestedStack(logicalId string) *cloudformationinclude.IncludedNestedStack

GetNestedStack retrieves a nested stack from the included template.

func (*CfnIncludeStack) GetResource

func (s *CfnIncludeStack) GetResource(logicalId string) awscdk.CfnResource

GetResource retrieves a resource from the included template by logical ID. Returns the resource as a CfnResource that can be modified.

type GatewayConfig

type GatewayConfig = iac.GatewayConfig

Type aliases for convenience - re-export from agentkit.

type IAMConfig

type IAMConfig = iac.IAMConfig

Type aliases for convenience - re-export from agentkit.

type ObservabilityConfig

type ObservabilityConfig = iac.ObservabilityConfig

Type aliases for convenience - re-export from agentkit.

type SecretsConfig

type SecretsConfig = iac.SecretsConfig

Type aliases for convenience - re-export from agentkit.

type StackBuilder

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

StackBuilder provides a fluent interface for building AgentCore stacks.

func NewStackBuilder

func NewStackBuilder(stackName string) *StackBuilder

NewStackBuilder creates a new stack builder.

func (*StackBuilder) Build

Build creates the AgentCore stack.

func (*StackBuilder) Config

func (b *StackBuilder) Config() StackConfig

Config returns the current configuration.

func (*StackBuilder) DestroyOnDelete

func (b *StackBuilder) DestroyOnDelete() *StackBuilder

DestroyOnDelete sets the removal policy to destroy.

func (*StackBuilder) RetainOnDelete

func (b *StackBuilder) RetainOnDelete() *StackBuilder

RetainOnDelete sets the removal policy to retain.

func (*StackBuilder) Validate

func (b *StackBuilder) Validate() error

Validate validates the current configuration.

func (*StackBuilder) WithAgent

func (b *StackBuilder) WithAgent(config AgentConfig) *StackBuilder

WithAgent adds an agent to the stack.

func (*StackBuilder) WithAgents

func (b *StackBuilder) WithAgents(configs ...AgentConfig) *StackBuilder

WithAgents adds multiple agents to the stack.

func (*StackBuilder) WithBedrockModels

func (b *StackBuilder) WithBedrockModels(modelIDs ...string) *StackBuilder

WithBedrockModels restricts Bedrock access to specific models.

func (*StackBuilder) WithCloudWatchOnly

func (b *StackBuilder) WithCloudWatchOnly(retentionDays int) *StackBuilder

WithCloudWatchOnly configures CloudWatch-only observability.

func (*StackBuilder) WithDefaultAgent

func (b *StackBuilder) WithDefaultAgent(name, containerImage string) *StackBuilder

WithDefaultAgent sets an agent as the default.

func (*StackBuilder) WithDescription

func (b *StackBuilder) WithDescription(description string) *StackBuilder

WithDescription sets the stack description.

func (*StackBuilder) WithExistingRole

func (b *StackBuilder) WithExistingRole(roleARN string) *StackBuilder

WithExistingRole uses an existing IAM role.

func (*StackBuilder) WithExistingVPC

func (b *StackBuilder) WithExistingVPC(vpcID string, subnetIDs []string) *StackBuilder

WithExistingVPC uses an existing VPC.

func (*StackBuilder) WithIAM

func (b *StackBuilder) WithIAM(config *IAMConfig) *StackBuilder

WithIAM configures IAM settings.

func (*StackBuilder) WithLangfuse

func (b *StackBuilder) WithLangfuse(project string, apiKeySecretARN string) *StackBuilder

WithLangfuse configures Langfuse observability.

func (*StackBuilder) WithNewVPC

func (b *StackBuilder) WithNewVPC(cidr string, maxAZs int) *StackBuilder

WithNewVPC creates a new VPC with the specified CIDR.

func (*StackBuilder) WithObservability

func (b *StackBuilder) WithObservability(config *ObservabilityConfig) *StackBuilder

WithObservability configures observability.

func (*StackBuilder) WithOpik

func (b *StackBuilder) WithOpik(project string, apiKeySecretARN string) *StackBuilder

WithOpik configures Opik observability.

func (*StackBuilder) WithRemovalPolicy

func (b *StackBuilder) WithRemovalPolicy(policy string) *StackBuilder

WithRemovalPolicy sets the removal policy.

func (*StackBuilder) WithSecretValues

func (b *StackBuilder) WithSecretValues(values map[string]string) *StackBuilder

WithSecretValues creates secrets with the provided values.

func (*StackBuilder) WithSecrets

func (b *StackBuilder) WithSecrets(config *SecretsConfig) *StackBuilder

WithSecrets configures secrets management.

func (*StackBuilder) WithSimpleAgent

func (b *StackBuilder) WithSimpleAgent(name, containerImage string) *StackBuilder

WithSimpleAgent adds an agent with minimal configuration.

func (*StackBuilder) WithTag

func (b *StackBuilder) WithTag(key, value string) *StackBuilder

WithTag adds a single tag.

func (*StackBuilder) WithTags

func (b *StackBuilder) WithTags(tags map[string]string) *StackBuilder

WithTags adds tags to all resources.

func (*StackBuilder) WithVPC

func (b *StackBuilder) WithVPC(config *VPCConfig) *StackBuilder

WithVPC configures VPC settings.

type StackConfig

type StackConfig = iac.StackConfig

Type aliases for convenience - re-export from agentkit.

type VPCConfig

type VPCConfig = iac.VPCConfig

Type aliases for convenience - re-export from agentkit.

Jump to

Keyboard shortcuts

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