bedrockagent

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2026 License: MIT Imports: 22 Imported by: 0

README

Bedrock Agent

Parity grade: A · SDK aws-sdk-go-v2/service/bedrockagent@v1.58.0 · last audited 2026-07-25 (8ddfcca9b7157a079a75e8cda1d26d70118f4ae9)

Coverage

Metric Value
Operations audited 77 (77 ok)
Feature families 3 (3 ok)
Known gaps 2
Deferred items 2
Resource leaks clean
Known gaps
  • "ValidateFlowDefinition always returns zero validation errors regardless of the definition passed — acceptable for a permissive emulator (the op still reads real state and returns the AWS-accurate empty-array shape); not a disguised no-op flag, just an easy target if flow-definition validation logic is ever wanted. Unchanged this sweep."
  • "Real AWS snapshots an agent's action groups, collaborators, and agent-KB associations into each numbered agent version at the moment CreateAgentAlias auto-creates it (confirmed via GetAgentActionGroup's API reference: its {agentVersion} path pattern is (DRAFT|[0-9]{0,4}[1-9][0-9]{0,4}), i.e. Get/List/Update/Delete accept non-DRAFT versions too, unlike Create/Associate which are DRAFT-only). gopherstack's newAgentVersionLocked only snapshots the Agent's own top-level fields, not these three sub-resource families, so GetAgentActionGroup/ListAgentCollaborators/etc. against a real numbered version always come back empty instead of a DRAFT-at-creation-time snapshot. This is a deeper feature gap (snapshot-forward propagation), not a simple bug; not fixed this sweep — found while verifying the new DRAFT-only Create/Associate validation below, listed here for the next sweep. (bd: TODO — file gopherstack-bedrockagent-version-snapshot)"
Deferred
  • "KBDocument/DataSource nested configuration blobs (dataSourceConfiguration, vectorIngestionConfiguration, knowledgeBaseConfiguration, storageConfiguration, actionGroupExecutor, apiSchema, functionSchema, guardrailConfiguration, memoryConfiguration, promptOverrideConfiguration) are passed through as opaque map[string]any/JSON blobs rather than typed + validated against the SDK's nested shape unions. This is consistent with how this service already treats them; deep-shape validation of these blobs was out of scope this sweep (unchanged)."
  • "IngestionJobStatistics' NumberOfDocumentsDeleted/NumberOfDocumentsFailed/ NumberOfModifiedDocumentsIndexed/NumberOfMetadataDocumentsScanned/ NumberOfMetadataDocumentsModified stay zero always (fixed this sweep: NumberOfDocumentsScanned/NumberOfNewDocumentsIndexed now reflect the real per-data-source document count). Reporting non-zero on the other five would require tracking a prior-job document snapshot to diff against, which this backend does not do — reporting a number there would be fabricated, not read from real state, so left at zero rather than invented. Also unmodeled: data sources backed by a real crawler type (S3/web/Confluence/etc.) have no actual external content for this emulator to scan, so their statistics are always zero regardless of the dataSourceConfiguration blob — only documents pushed via the separate IngestKnowledgeBaseDocuments custom-content API are counted."

More

Documentation

Overview

Package bedrockagent provides a local stub for the Amazon Bedrock Agent service.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotFound is returned when a requested resource does not exist.
	ErrNotFound = awserr.New("ResourceNotFoundException", awserr.ErrNotFound)
	// ErrAlreadyExists is returned when a resource with the given name already exists.
	ErrAlreadyExists = awserr.New("ConflictException", awserr.ErrAlreadyExists)
	// ErrValidation is returned for invalid request parameters.
	ErrValidation = awserr.New("ValidationException", awserr.ErrInvalidParameter)
)
View Source
var ErrNilAppContext = errors.New("bedrockagent: AppContext must not be nil")

ErrNilAppContext is returned when a nil AppContext is passed to Provider.Init.

Functions

This section is empty.

Types

type ActionGroupConfig

type ActionGroupConfig struct {
	ActionGroupExecutor map[string]any
	APISchema           map[string]any
	FunctionSchema      map[string]any
	ActionGroupName     string
	Description         string
	ActionGroupState    string
}

ActionGroupConfig holds fields for creating or updating an AgentActionGroup.

type ActionGroupSummary

type ActionGroupSummary struct {
	ActionGroupID    string `json:"actionGroupId"`
	ActionGroupName  string `json:"actionGroupName"`
	ActionGroupState string `json:"actionGroupState"`
	Description      string `json:"description,omitempty"`
}

ActionGroupSummary is used in list responses.

type Agent

type Agent struct {
	CreatedAt                   time.Time      `json:"createdAt"`
	UpdatedAt                   time.Time      `json:"updatedAt"`
	PreparedAt                  *time.Time     `json:"preparedAt,omitempty"`
	Guardrail                   map[string]any `json:"guardrailConfiguration,omitempty"`
	Memory                      map[string]any `json:"memoryConfiguration,omitempty"`
	PromptOverrideConfiguration map[string]any `json:"promptOverrideConfiguration"`
	AgentID                     string         `json:"agentId"`
	AgentARN                    string         `json:"agentArn"`
	AgentName                   string         `json:"agentName"`
	AgentVersion                string         `json:"agentVersion"`
	AgentStatus                 string         `json:"agentStatus"`
	Collaboration               string         `json:"agentCollaboration"`
	Description                 string         `json:"description,omitempty"`
	FoundationModel             string         `json:"foundationModel,omitempty"`
	Instruction                 string         `json:"instruction,omitempty"`
	RoleARN                     string         `json:"agentResourceRoleArn,omitempty"`
	IdleSessionTTLInSeconds     int            `json:"idleSessionTTLInSeconds"`
}

Agent represents a Bedrock Agent.

Tags are deliberately NOT a field here: the real aws-sdk-go-v2 types.Agent (returned by CreateAgent/GetAgent/UpdateAgent) has no "tags" member -- tags are write-only on CreateAgentInput and only ever read back via ListTagsForResource. gopherstack used to echo an invented "tags" key in these responses; that struct field is gone, and CreateAgent seeds b.tags[AgentARN] directly instead (see agents.go).

type AgentActionGroup

type AgentActionGroup struct {
	CreatedAt           time.Time      `json:"createdAt"`
	UpdatedAt           time.Time      `json:"updatedAt"`
	ActionGroupExecutor map[string]any `json:"actionGroupExecutor,omitempty"`
	APISchema           map[string]any `json:"apiSchema,omitempty"`
	FunctionSchema      map[string]any `json:"functionSchema,omitempty"`
	ActionGroupID       string         `json:"actionGroupId"`
	ActionGroupName     string         `json:"actionGroupName"`
	AgentID             string         `json:"agentId"`
	AgentVersion        string         `json:"agentVersion"`
	ActionGroupState    string         `json:"actionGroupState"`
	Description         string         `json:"description,omitempty"`
}

AgentActionGroup is an action group attached to an agent version.

type AgentAlias

type AgentAlias struct {
	CreatedAt            time.Time      `json:"createdAt"`
	UpdatedAt            time.Time      `json:"updatedAt"`
	AgentAliasID         string         `json:"agentAliasId"`
	AgentAliasARN        string         `json:"agentAliasArn"`
	AgentAliasName       string         `json:"agentAliasName"`
	AgentAliasStatus     string         `json:"agentAliasStatus"`
	AgentID              string         `json:"agentId"`
	Description          string         `json:"description,omitempty"`
	RoutingConfiguration []AliasRouting `json:"routingConfiguration"`
}

AgentAlias routes traffic to a specific agent version. Tags are deliberately NOT a field here -- the real types.AgentAlias has no "tags" member; CreateAgentAlias seeds b.tags[AgentAliasARN] directly instead.

type AgentAliasSummary

type AgentAliasSummary struct {
	AgentAliasID     string `json:"agentAliasId"`
	AgentAliasName   string `json:"agentAliasName"`
	AgentAliasStatus string `json:"agentAliasStatus"`
	Description      string `json:"description,omitempty"`
}

AgentAliasSummary is used in list responses.

type AgentCollaborator

type AgentCollaborator struct {
	CreatedAt                time.Time      `json:"createdAt"`
	UpdatedAt                time.Time      `json:"updatedAt"`
	AgentDescriptor          map[string]any `json:"agentDescriptor,omitempty"`
	AgentID                  string         `json:"agentId"`
	AgentVersion             string         `json:"agentVersion"`
	CollaboratorID           string         `json:"collaboratorId"`
	CollaboratorName         string         `json:"collaboratorName"`
	CollaborationInstruction string         `json:"collaborationInstruction,omitempty"`
	RelayConversationHistory string         `json:"relayConversationHistory,omitempty"`
	CollaboratorStatus       string         `json:"collaboratorStatus"`
}

AgentCollaborator links two agents for multi-agent collaboration.

type AgentConfig

type AgentConfig struct {
	Tags                    map[string]string
	Guardrail               map[string]any
	Memory                  map[string]any
	AgentName               string
	Collaboration           string
	Description             string
	FoundationModel         string
	Instruction             string
	RoleARN                 string
	IdleSessionTTLInSeconds int
}

AgentConfig holds fields for creating or updating an Agent.

type AgentKnowledgeBase

type AgentKnowledgeBase struct {
	CreatedAt       time.Time `json:"createdAt"`
	UpdatedAt       time.Time `json:"updatedAt"`
	AgentID         string    `json:"agentId"`
	AgentVersion    string    `json:"agentVersion"`
	KnowledgeBaseID string    `json:"knowledgeBaseId"`
	KBState         string    `json:"knowledgeBaseState"`
	Description     string    `json:"description,omitempty"`
}

AgentKnowledgeBase is the association between an agent and a knowledge base.

type AgentSummary

type AgentSummary struct {
	UpdatedAt   time.Time `json:"updatedAt"`
	AgentID     string    `json:"agentId"`
	AgentName   string    `json:"agentName"`
	AgentStatus string    `json:"agentStatus"`
	Description string    `json:"description,omitempty"`
}

AgentSummary is the condensed agent representation used in list responses.

type AgentVersion

type AgentVersion struct {
	CreatedAt       time.Time `json:"createdAt"`
	UpdatedAt       time.Time `json:"updatedAt"`
	AgentID         string    `json:"agentId"`
	AgentARN        string    `json:"agentArn"`
	AgentName       string    `json:"agentName"`
	AgentStatus     string    `json:"agentStatus"`
	AgentVersion    string    `json:"agentVersion"`
	Description     string    `json:"description,omitempty"`
	FoundationModel string    `json:"foundationModel,omitempty"`
	Instruction     string    `json:"instruction,omitempty"`
	RoleARN         string    `json:"agentResourceRoleArn,omitempty"`
}

AgentVersion holds a snapshot version of an agent.

type AgentVersionSummary

type AgentVersionSummary struct {
	UpdatedAt    time.Time `json:"updatedAt"`
	AgentName    string    `json:"agentName"`
	AgentStatus  string    `json:"agentStatus"`
	AgentVersion string    `json:"agentVersion"`
	Description  string    `json:"description,omitempty"`
}

AgentVersionSummary is used in list-agent-versions responses.

type AliasConfig

type AliasConfig struct {
	Tags                 map[string]string
	AliasName            string
	Description          string
	RoutingConfiguration []AliasRouting
}

AliasConfig holds fields for creating or updating an AgentAlias.

type AliasRouting

type AliasRouting struct {
	AgentVersion string `json:"agentVersion"`
}

AliasRouting maps an alias to an agent version.

type CollaboratorConfig

type CollaboratorConfig struct {
	AgentDescriptor          map[string]any
	CollaboratorName         string
	CollaborationInstruction string
	RelayConversationHistory string
}

CollaboratorConfig holds fields for an AgentCollaborator.

type DataSource

type DataSource struct {
	CreatedAt               time.Time      `json:"createdAt"`
	UpdatedAt               time.Time      `json:"updatedAt"`
	DataSourceConfiguration map[string]any `json:"dataSourceConfiguration,omitempty"`
	VectorIngestionConfig   map[string]any `json:"vectorIngestionConfiguration,omitempty"`
	DataSourceID            string         `json:"dataSourceId"`
	KnowledgeBaseID         string         `json:"knowledgeBaseId"`
	Name                    string         `json:"name"`
	DataSourceStatus        string         `json:"dataSourceStatus"`
	Description             string         `json:"description,omitempty"`
	DataDeletionPolicy      string         `json:"dataDeletionPolicy,omitempty"`
}

DataSource is a knowledge base data source.

type DataSourceConfig

type DataSourceConfig struct {
	DataSourceConfiguration map[string]any
	VectorIngestionConfig   map[string]any
	Name                    string
	Description             string
	DataDeletionPolicy      string
}

DataSourceConfig holds fields for creating or updating a DataSource.

type DataSourceSummary

type DataSourceSummary struct {
	UpdatedAt        time.Time `json:"updatedAt"`
	DataSourceID     string    `json:"dataSourceId"`
	KnowledgeBaseID  string    `json:"knowledgeBaseId"`
	Name             string    `json:"name"`
	DataSourceStatus string    `json:"dataSourceStatus"`
	Description      string    `json:"description,omitempty"`
}

DataSourceSummary is used in list responses.

type Flow

type Flow struct {
	CreatedAt   time.Time      `json:"createdAt"`
	UpdatedAt   time.Time      `json:"updatedAt"`
	Definition  map[string]any `json:"definition,omitempty"`
	FlowID      string         `json:"id"`
	FlowARN     string         `json:"arn"`
	Name        string         `json:"name"`
	Status      string         `json:"status"`
	Description string         `json:"description,omitempty"`
	RoleARN     string         `json:"executionRoleArn,omitempty"`
	Version     string         `json:"version"`
}

Flow is a Bedrock prompt flow. Tags are deliberately NOT a field here -- the real GetFlowOutput/CreateFlowOutput has no "tags" member; CreateFlow seeds b.tags[FlowARN] directly instead.

type FlowAlias

type FlowAlias struct {
	CreatedAt            time.Time          `json:"createdAt"`
	UpdatedAt            time.Time          `json:"updatedAt"`
	AliasID              string             `json:"id"`
	AliasARN             string             `json:"arn"`
	FlowID               string             `json:"flowId"`
	Name                 string             `json:"name"`
	Description          string             `json:"description,omitempty"`
	RoutingConfiguration []FlowAliasRouting `json:"routingConfiguration,omitempty"`
}

FlowAlias routes traffic to a specific flow version. Tags are deliberately NOT a field here -- the real CreateFlowAliasOutput has no "tags" member; CreateFlowAlias seeds b.tags[AliasARN] directly instead.

type FlowAliasConfig

type FlowAliasConfig struct {
	Tags                 map[string]string
	Name                 string
	Description          string
	RoutingConfiguration []FlowAliasRouting
}

FlowAliasConfig holds fields for creating or updating a FlowAlias.

type FlowAliasRouting

type FlowAliasRouting struct {
	FlowVersion string `json:"flowVersion"`
}

FlowAliasRouting maps a flow alias to a specific flow version.

type FlowAliasSummary

type FlowAliasSummary struct {
	CreatedAt   time.Time `json:"createdAt"`
	UpdatedAt   time.Time `json:"updatedAt"`
	AliasID     string    `json:"id"`
	AliasARN    string    `json:"arn"`
	FlowID      string    `json:"flowId"`
	Name        string    `json:"name"`
	Description string    `json:"description,omitempty"`
}

FlowAliasSummary is used in list responses.

type FlowConfig

type FlowConfig struct {
	Tags        map[string]string
	Definition  map[string]any
	Name        string
	Description string
	RoleARN     string
}

FlowConfig holds fields for creating or updating a Flow.

type FlowSummary

type FlowSummary struct {
	UpdatedAt   time.Time `json:"updatedAt"`
	FlowID      string    `json:"id"`
	Name        string    `json:"name"`
	Status      string    `json:"status"`
	Description string    `json:"description,omitempty"`
	Version     string    `json:"version"`
}

FlowSummary is used in list responses.

type FlowValidationError

type FlowValidationError struct {
	Message  string `json:"message"`
	Severity string `json:"severity"`
}

FlowValidationError is a flow definition validation error.

type FlowVersion

type FlowVersion struct {
	CreatedAt   time.Time      `json:"createdAt"`
	Definition  map[string]any `json:"definition,omitempty"`
	FlowARN     string         `json:"arn"`
	FlowID      string         `json:"id"`
	Name        string         `json:"name"`
	Status      string         `json:"status"`
	Version     string         `json:"version"`
	Description string         `json:"description,omitempty"`
}

FlowVersion is a snapshot of a flow.

type FlowVersionSummary

type FlowVersionSummary struct {
	CreatedAt   time.Time `json:"createdAt"`
	Arn         string    `json:"arn"`
	FlowID      string    `json:"id"`
	Name        string    `json:"name"`
	Status      string    `json:"status"`
	Version     string    `json:"version"`
	Description string    `json:"description,omitempty"`
}

FlowVersionSummary is used in list responses.

type Handler

type Handler struct {
	Backend       StorageBackend
	AccountID     string
	DefaultRegion string
}

Handler is the HTTP handler for the Bedrock Agent REST API.

func NewHandler

func NewHandler(backend StorageBackend) *Handler

NewHandler creates a new Bedrock Agent handler.

func (*Handler) ChaosOperations

func (h *Handler) ChaosOperations() []string

ChaosOperations returns all operations.

func (*Handler) ChaosRegions

func (h *Handler) ChaosRegions() []string

ChaosRegions returns the supported regions.

func (*Handler) ChaosServiceName

func (h *Handler) ChaosServiceName() string

ChaosServiceName returns the chaos service name.

func (*Handler) ExtractOperation

func (h *Handler) ExtractOperation(c *echo.Context) string

ExtractOperation determines the operation name from the request.

func (*Handler) ExtractResource

func (h *Handler) ExtractResource(c *echo.Context) string

ExtractResource extracts an agent or flow ID from the request path.

func (*Handler) GetSupportedOperations

func (h *Handler) GetSupportedOperations() []string

GetSupportedOperations returns the list of supported operations.

func (*Handler) Handler

func (h *Handler) Handler() echo.HandlerFunc

Handler returns the Echo handler function.

func (*Handler) MatchPriority

func (h *Handler) MatchPriority() int

MatchPriority returns routing priority.

func (*Handler) Name

func (h *Handler) Name() string

Name returns the service name.

func (*Handler) Reset

func (h *Handler) Reset()

Reset clears handler state (delegates to backend).

func (*Handler) Restore

func (h *Handler) Restore(ctx context.Context, data []byte) error

Restore implements persistence.Persistable by delegating to the backend.

func (*Handler) RouteMatcher

func (h *Handler) RouteMatcher() service.Matcher

RouteMatcher returns a function matching Bedrock Agent requests.

func (*Handler) Snapshot

func (h *Handler) Snapshot(ctx context.Context) []byte

Snapshot implements persistence.Persistable by delegating to the backend. Handler previously had no Snapshot/Restore of its own -- and neither did InMemoryBackend -- so cli.go's generic setupPersistence (which type-asserts the registered service.Registerable, i.e. the Handler, for a Snapshot/Restore pair) never picked BedrockAgent up at all: dead wiring, with no persistence underneath it either. This delegation (matching the codecommit/codepipeline/cleanrooms pattern) is what wires BedrockAgent into persistence for the first time.

type InMemoryBackend

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

InMemoryBackend implements StorageBackend with in-memory maps, isolated by region.

Phase 3.3 datalayer conversion: every map[string]*T resource collection is a *store.Table[T] registered on b.registry, with a *store.Index[T] added where a parent-scoped List/bulk-delete previously did a linear key-prefix scan (see store_setup.go's registerAllTables). Resources with a real, globally-unique identity field (agents, knowledgeBases, flows, prompts) are registered directly by that ID; resources whose ID is only unique within a parent (agent/flow/knowledge-base versions, action groups, aliases, collaborators, associations, data sources, ingestion jobs, KB documents) keep the same "parent/child[/grandchild]" composite key the original map already used, matching the composite-key rule in .claude/memories/parity-principles.md.

agentsByName, kbsByName, flowsByName, and promptsByName are left as plain map[string]string reverse-lookup caches (name -> ID): their values are bare strings, not *T, so there is nothing for store.Table to key on. agentVersionCtrs, flowVersionCtrs, and promptVersionCtrs (map[string]int) are likewise left raw for the same reason. tags (map[string]map[string]string) is the one remaining grouping map with a non-*T value.

func NewInMemoryBackend

func NewInMemoryBackend(region, accountID string) *InMemoryBackend

NewInMemoryBackend creates and initialises an InMemoryBackend.

func (*InMemoryBackend) AssociateAgentCollaborator

func (b *InMemoryBackend) AssociateAgentCollaborator(
	_ context.Context, agentID, agentVersion string, cfg CollaboratorConfig,
) (*AgentCollaborator, error)

AssociateAgentCollaborator creates a collaborator association.

Real AWS constrains the {agentVersion} URI path parameter to the literal "DRAFT" (fixed length 5, pattern `DRAFT`, per the AssociateAgentCollaborator API reference) -- same constraint as CreateAgentActionGroup.

func (*InMemoryBackend) AssociateAgentKnowledgeBase

func (b *InMemoryBackend) AssociateAgentKnowledgeBase(
	_ context.Context, agentID, agentVersion, kbID, description, kbState string,
) (*AgentKnowledgeBase, error)

AssociateAgentKnowledgeBase creates an agent–KB association.

Real AWS constrains the {agentVersion} URI path parameter to the literal "DRAFT" (fixed length 5, pattern `DRAFT`, per the AssociateAgentKnowledgeBase API reference) -- same constraint as CreateAgentActionGroup.

func (*InMemoryBackend) CreateAgent

func (b *InMemoryBackend) CreateAgent(ctx context.Context, cfg AgentConfig) (*Agent, error)

CreateAgent creates a new agent.

func (*InMemoryBackend) CreateAgentActionGroup

func (b *InMemoryBackend) CreateAgentActionGroup(
	_ context.Context, agentID, agentVersion string, cfg ActionGroupConfig,
) (*AgentActionGroup, error)

CreateAgentActionGroup creates an action group for an agent version.

Real AWS constrains the {agentVersion} URI path parameter to the literal "DRAFT" (fixed length 5, pattern `DRAFT`, per the CreateAgentActionGroup API reference) -- action groups can only ever be created against the mutable DRAFT version; numbered versions are immutable snapshots. A request path with any other value fails validation.

func (*InMemoryBackend) CreateAgentAlias

func (b *InMemoryBackend) CreateAgentAlias(
	ctx context.Context, agentID string, cfg AliasConfig,
) (*AgentAlias, error)

CreateAgentAlias creates an alias for an agent.

func (*InMemoryBackend) CreateAgentVersion

func (b *InMemoryBackend) CreateAgentVersion(
	_ context.Context, agentID, description string,
) (*AgentVersion, error)

CreateAgentVersion creates a numbered snapshot of an agent.

Note: real Bedrock Agents has no CreateAgentVersion wire operation -- numbered agent versions are created as a side effect of CreateAgentAlias when called with no routingConfiguration (see the doAgentAlias helper in CreateAgentAlias below, which calls newAgentVersionLocked directly while already holding b.mu). This method stays exported on InMemoryBackend/ StorageBackend for internal/programmatic use (e.g. tests seeding a version directly) but is deliberately not reachable from any HTTP route.

func (*InMemoryBackend) CreateDataSource

func (b *InMemoryBackend) CreateDataSource(
	_ context.Context, kbID string, cfg DataSourceConfig,
) (*DataSource, error)

CreateDataSource creates a data source in a knowledge base.

func (*InMemoryBackend) CreateFlow

func (b *InMemoryBackend) CreateFlow(ctx context.Context, cfg FlowConfig) (*Flow, error)

CreateFlow creates a new flow.

func (*InMemoryBackend) CreateFlowAlias

func (b *InMemoryBackend) CreateFlowAlias(
	ctx context.Context, flowID string, cfg FlowAliasConfig,
) (*FlowAlias, error)

CreateFlowAlias creates a flow alias.

func (*InMemoryBackend) CreateFlowVersion

func (b *InMemoryBackend) CreateFlowVersion(
	_ context.Context, flowID, description string,
) (*FlowVersion, error)

CreateFlowVersion creates a numbered snapshot of a flow.

func (*InMemoryBackend) CreateKnowledgeBase

func (b *InMemoryBackend) CreateKnowledgeBase(
	ctx context.Context, cfg KnowledgeBaseConfig,
) (*KnowledgeBase, error)

CreateKnowledgeBase creates a new knowledge base.

func (*InMemoryBackend) CreatePrompt

func (b *InMemoryBackend) CreatePrompt(ctx context.Context, cfg PromptConfig) (*Prompt, error)

CreatePrompt creates a new prompt.

func (*InMemoryBackend) CreatePromptVersion

func (b *InMemoryBackend) CreatePromptVersion(
	_ context.Context, promptID, description string,
) (*PromptVersion, error)

CreatePromptVersion creates a versioned snapshot of a prompt.

func (*InMemoryBackend) DeleteAgent

func (b *InMemoryBackend) DeleteAgent(_ context.Context, agentID string) error

DeleteAgent deletes an agent.

Note: this only removes the agent itself, its name-lookup entry, its versions (agentVersions), its version counter, every action group / agent collaborator / KB association scoped under any of those versions (including DRAFT), every alias, and the agent's own tags entry.

This used to leave every one of those behind as ghost rows (documented historically as a "preserved as-is" no-op cleanup bug from the pre-Phase-3.3 map-based backend) -- fixed here: actionGroups, agentCollaborators, and agentKBAssocs are indexed by the composite "agentID/agentVersion" scope, so cascading them requires walking DRAFT plus every numbered AgentVersion row and clearing each scope; agentAliases carries a plain byAgent index so no version walk is needed there.

func (*InMemoryBackend) DeleteAgentActionGroup

func (b *InMemoryBackend) DeleteAgentActionGroup(
	_ context.Context, agentID, agentVersion, actionGroupID string,
) error

DeleteAgentActionGroup deletes an action group.

func (*InMemoryBackend) DeleteAgentAlias

func (b *InMemoryBackend) DeleteAgentAlias(_ context.Context, agentID, aliasID string) error

DeleteAgentAlias deletes an agent alias and its tags map entry.

func (*InMemoryBackend) DeleteAgentVersion

func (b *InMemoryBackend) DeleteAgentVersion(
	_ context.Context, agentID, agentVersion string,
) error

DeleteAgentVersion deletes an agent version. See the not-found precedence note on GetAgentVersion.

func (*InMemoryBackend) DeleteDataSource

func (b *InMemoryBackend) DeleteDataSource(_ context.Context, kbID, dsID string) error

DeleteDataSource deletes a data source, cascade-cleaning every ingestion job and ingested KB document scoped under it.

func (*InMemoryBackend) DeleteFlow

func (b *InMemoryBackend) DeleteFlow(_ context.Context, flowID string) error

DeleteFlow deletes a flow.

func (*InMemoryBackend) DeleteFlowAlias

func (b *InMemoryBackend) DeleteFlowAlias(_ context.Context, flowID, aliasID string) error

DeleteFlowAlias deletes a flow alias.

func (*InMemoryBackend) DeleteFlowVersion

func (b *InMemoryBackend) DeleteFlowVersion(_ context.Context, flowID, flowVersion string) error

DeleteFlowVersion deletes a flow version.

func (*InMemoryBackend) DeleteKnowledgeBase

func (b *InMemoryBackend) DeleteKnowledgeBase(_ context.Context, kbID string) error

DeleteKnowledgeBase deletes a knowledge base and cascade-cleans every resource scoped under it: data sources, and (per data source) ingestion jobs and ingested KB documents, plus the KB's own tags and its resource policy (bedrock-agent's PutResourcePolicy/GetResourcePolicy/ DeleteResourcePolicy attach only to knowledge bases -- see resource_policy.go). Without this, a deleted-and-recreated KB with the same auto-incremented ID space would never actually observe empty child collections, and the tags/resourcePolicies maps would keep a permanent ghost entry keyed by the now-invalid ARN.

func (*InMemoryBackend) DeleteKnowledgeBaseDocuments

func (b *InMemoryBackend) DeleteKnowledgeBaseDocuments(
	_ context.Context, kbID, dsID string, docIDs []string,
) ([]KBDocumentDetail, error)

DeleteKnowledgeBaseDocuments deletes documents from a knowledge base data source.

func (*InMemoryBackend) DeletePrompt

func (b *InMemoryBackend) DeletePrompt(_ context.Context, promptID string) error

DeletePrompt deletes a prompt.

func (*InMemoryBackend) DeletePromptVersion

func (b *InMemoryBackend) DeletePromptVersion(
	_ context.Context, promptID, version string,
) error

DeletePromptVersion deletes a prompt version.

func (*InMemoryBackend) DeleteResourcePolicy added in v1.2.0

func (b *InMemoryBackend) DeleteResourcePolicy(
	_ context.Context, resourceArn, expectedRevisionID string,
) (string, error)

DeleteResourcePolicy removes the resource policy attached to a knowledge base ARN, returning the revision ID the deleted policy had -- AWS's documented DeleteResourcePolicyOutput.revisionId is "the revision identifier after the resource policy was deleted", which this backend interprets as the last revision the (now-removed) policy carried, matching how PutResourcePolicy's response documents "[u]se this value in the expectedRevisionId field of a subsequent ... DeleteResourcePolicy request" -- i.e. revisionId is a handle on a specific policy revision, not a live counter that keeps advancing after the row is gone. See this file's package doc comment for expectedRevisionID semantics.

func (*InMemoryBackend) DisassociateAgentCollaborator

func (b *InMemoryBackend) DisassociateAgentCollaborator(
	_ context.Context, agentID, agentVersion, collaboratorID string,
) error

DisassociateAgentCollaborator removes a collaborator.

func (*InMemoryBackend) DisassociateAgentKnowledgeBase

func (b *InMemoryBackend) DisassociateAgentKnowledgeBase(
	_ context.Context, agentID, agentVersion, kbID string,
) error

DisassociateAgentKnowledgeBase removes an agent–KB association.

func (*InMemoryBackend) GetAgent

func (b *InMemoryBackend) GetAgent(_ context.Context, agentID string) (*Agent, error)

GetAgent returns an agent by ID.

func (*InMemoryBackend) GetAgentActionGroup

func (b *InMemoryBackend) GetAgentActionGroup(
	_ context.Context, agentID, agentVersion, actionGroupID string,
) (*AgentActionGroup, error)

GetAgentActionGroup returns an action group.

func (*InMemoryBackend) GetAgentAlias

func (b *InMemoryBackend) GetAgentAlias(_ context.Context, agentID, aliasID string) (*AgentAlias, error)

GetAgentAlias returns an agent alias.

func (*InMemoryBackend) GetAgentCollaborator

func (b *InMemoryBackend) GetAgentCollaborator(
	_ context.Context, agentID, agentVersion, collaboratorID string,
) (*AgentCollaborator, error)

GetAgentCollaborator returns a collaborator by ID.

func (*InMemoryBackend) GetAgentKnowledgeBase

func (b *InMemoryBackend) GetAgentKnowledgeBase(
	_ context.Context, agentID, agentVersion, kbID string,
) (*AgentKnowledgeBase, error)

GetAgentKnowledgeBase returns an agent–KB association.

func (*InMemoryBackend) GetAgentVersion

func (b *InMemoryBackend) GetAgentVersion(
	_ context.Context, agentID, agentVersion string,
) (*AgentVersion, error)

GetAgentVersion returns a specific agent version.

Not-found precedence note: the pre-Phase-3.3 map checked for the presence of the per-agent inner map (created lazily by the first CreateAgentVersion call and never removed except by DeleteAgent) to decide between "agent not found" and "agent version not found". That inner-map presence check is not reproducible with a flat store.Table + secondary Index (an Index prunes a group the moment its last member is deleted, see pkgs/store's Index.remove), so this checks b.agents.Has(agentID) instead -- identical result in every case except the one where every version of a still-existing agent has been deleted via DeleteAgentVersion, where the pre-conversion code returned "agent not found" (arguably itself a mislabeled error) and this returns "agent version not found".

func (*InMemoryBackend) GetDataSource

func (b *InMemoryBackend) GetDataSource(_ context.Context, kbID, dsID string) (*DataSource, error)

GetDataSource returns a data source.

func (*InMemoryBackend) GetFlow

func (b *InMemoryBackend) GetFlow(_ context.Context, flowID string) (*Flow, error)

GetFlow returns a flow.

func (*InMemoryBackend) GetFlowAlias

func (b *InMemoryBackend) GetFlowAlias(_ context.Context, flowID, aliasID string) (*FlowAlias, error)

GetFlowAlias returns a flow alias.

func (*InMemoryBackend) GetFlowVersion

func (b *InMemoryBackend) GetFlowVersion(
	_ context.Context, flowID, flowVersion string,
) (*FlowVersion, error)

GetFlowVersion returns a flow version. See the not-found precedence note on GetAgentVersion in the Agent version CRUD section above -- the same b.flows.Has(flowID)-instead-of-inner-map-presence reasoning applies here.

func (*InMemoryBackend) GetIngestionJob

func (b *InMemoryBackend) GetIngestionJob(
	_ context.Context, kbID, dsID, jobID string,
) (*IngestionJob, error)

GetIngestionJob returns an ingestion job.

func (*InMemoryBackend) GetKnowledgeBase

func (b *InMemoryBackend) GetKnowledgeBase(_ context.Context, kbID string) (*KnowledgeBase, error)

GetKnowledgeBase returns a knowledge base.

func (*InMemoryBackend) GetKnowledgeBaseDocuments

func (b *InMemoryBackend) GetKnowledgeBaseDocuments(
	_ context.Context, kbID, dsID string, docIDs []string,
) ([]KBDocumentDetail, error)

GetKnowledgeBaseDocuments retrieves document details.

func (*InMemoryBackend) GetPrompt

func (b *InMemoryBackend) GetPrompt(_ context.Context, promptID string) (*Prompt, error)

GetPrompt returns a prompt.

func (*InMemoryBackend) GetPromptVersion

func (b *InMemoryBackend) GetPromptVersion(
	_ context.Context, promptID, version string,
) (*PromptVersion, error)

GetPromptVersion returns a specific prompt version. See the not-found precedence note on GetAgentVersion in the Agent version CRUD section above -- the same b.prompts.Has(promptID)-instead-of-inner-map-presence reasoning applies here.

func (*InMemoryBackend) GetResourcePolicy added in v1.2.0

func (b *InMemoryBackend) GetResourcePolicy(_ context.Context, resourceArn string) (*ResourcePolicy, error)

GetResourcePolicy returns the resource policy attached to a knowledge base ARN.

func (*InMemoryBackend) IngestKnowledgeBaseDocuments

func (b *InMemoryBackend) IngestKnowledgeBaseDocuments(
	_ context.Context, kbID, dsID string, docs []KBDocument,
) ([]KBDocumentDetail, error)

IngestKnowledgeBaseDocuments ingests documents into a knowledge base data source.

func (*InMemoryBackend) ListAgentActionGroups

func (b *InMemoryBackend) ListAgentActionGroups(
	_ context.Context, agentID, agentVersion string, maxResults int, nextToken string,
) ([]*ActionGroupSummary, string, error)

ListAgentActionGroups returns all action groups for an agent version.

func (*InMemoryBackend) ListAgentAliases

func (b *InMemoryBackend) ListAgentAliases(
	_ context.Context, agentID string, maxResults int, nextToken string,
) ([]*AgentAliasSummary, string, error)

ListAgentAliases returns paginated alias summaries for an agent.

func (*InMemoryBackend) ListAgentCollaborators

func (b *InMemoryBackend) ListAgentCollaborators(
	_ context.Context, agentID, agentVersion string, maxResults int, nextToken string,
) ([]*AgentCollaborator, string, error)

ListAgentCollaborators returns paginated collaborators.

func (*InMemoryBackend) ListAgentKnowledgeBases

func (b *InMemoryBackend) ListAgentKnowledgeBases(
	_ context.Context, agentID, agentVersion string, maxResults int, nextToken string,
) ([]*AgentKnowledgeBase, string, error)

ListAgentKnowledgeBases returns paginated agent–KB associations.

func (*InMemoryBackend) ListAgentVersions

func (b *InMemoryBackend) ListAgentVersions(
	_ context.Context, agentID string, maxResults int, nextToken string,
) ([]*AgentVersionSummary, string, error)

ListAgentVersions returns paginated agent version summaries.

func (*InMemoryBackend) ListAgents

func (b *InMemoryBackend) ListAgents(
	_ context.Context, maxResults int, nextToken string,
) ([]*AgentSummary, string, error)

ListAgents returns a paginated list of agent summaries.

func (*InMemoryBackend) ListDataSources

func (b *InMemoryBackend) ListDataSources(
	_ context.Context, kbID string, maxResults int, nextToken string,
) ([]*DataSourceSummary, string, error)

ListDataSources returns paginated data source summaries.

func (*InMemoryBackend) ListFlowAliases

func (b *InMemoryBackend) ListFlowAliases(
	_ context.Context, flowID string, maxResults int, nextToken string,
) ([]*FlowAliasSummary, string, error)

ListFlowAliases returns paginated flow alias summaries.

func (*InMemoryBackend) ListFlowVersions

func (b *InMemoryBackend) ListFlowVersions(
	_ context.Context, flowID string, maxResults int, nextToken string,
) ([]*FlowVersionSummary, string, error)

ListFlowVersions returns paginated flow version summaries.

func (*InMemoryBackend) ListFlows

func (b *InMemoryBackend) ListFlows(
	_ context.Context, maxResults int, nextToken string,
) ([]*FlowSummary, string, error)

ListFlows returns paginated flow summaries.

func (*InMemoryBackend) ListIngestionJobs

func (b *InMemoryBackend) ListIngestionJobs(
	_ context.Context, kbID, dsID string, maxResults int, nextToken string,
) ([]*IngestionJob, string, error)

ListIngestionJobs returns paginated ingestion job summaries.

func (*InMemoryBackend) ListKnowledgeBaseDocuments

func (b *InMemoryBackend) ListKnowledgeBaseDocuments(
	_ context.Context, kbID, dsID string, maxResults int, nextToken string,
) ([]KBDocumentDetail, string, error)

ListKnowledgeBaseDocuments returns paginated document details.

func (*InMemoryBackend) ListKnowledgeBases

func (b *InMemoryBackend) ListKnowledgeBases(
	_ context.Context, maxResults int, nextToken string,
) ([]*KnowledgeBaseSummary, string, error)

ListKnowledgeBases returns paginated knowledge base summaries.

func (*InMemoryBackend) ListPrompts

func (b *InMemoryBackend) ListPrompts(
	_ context.Context, maxResults int, nextToken string,
) ([]*PromptSummary, string, error)

ListPrompts returns paginated prompt summaries.

func (*InMemoryBackend) ListTagsForResource

func (b *InMemoryBackend) ListTagsForResource(
	_ context.Context, resourceARN string,
) (map[string]string, error)

ListTagsForResource returns tags for a resource ARN.

func (*InMemoryBackend) PrepareAgent

func (b *InMemoryBackend) PrepareAgent(_ context.Context, agentID string) (*Agent, error)

PrepareAgent transitions agent to PREPARED status.

func (*InMemoryBackend) PrepareFlow

func (b *InMemoryBackend) PrepareFlow(_ context.Context, flowID string) (*Flow, error)

PrepareFlow transitions a flow to prepared status.

func (*InMemoryBackend) PutResourcePolicy added in v1.2.0

func (b *InMemoryBackend) PutResourcePolicy(
	_ context.Context, resourceArn, policy, expectedRevisionID string,
) (*ResourcePolicy, error)

PutResourcePolicy creates or replaces the resource policy attached to a knowledge base ARN. resourceArn must match the real, documented knowledge-base-only ARN pattern AND resolve to a knowledge base this backend actually has -- a policy must not attach to a nonexistent resource. See this file's package doc comment for expectedRevisionID semantics.

func (*InMemoryBackend) Reset

func (b *InMemoryBackend) Reset()

Reset clears all backend state (used in tests).

func (*InMemoryBackend) Restore

func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error

Restore deserializes backend state from a snapshot. It implements persistence.Persistable.

func (*InMemoryBackend) Snapshot

func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte

Snapshot serializes the backend state to JSON. It implements persistence.Persistable.

func (*InMemoryBackend) StartIngestionJob

func (b *InMemoryBackend) StartIngestionJob(
	_ context.Context, kbID, dsID, description string,
) (*IngestionJob, error)

StartIngestionJob creates and starts a new ingestion job.

func (*InMemoryBackend) StopIngestionJob

func (b *InMemoryBackend) StopIngestionJob(
	_ context.Context, kbID, dsID, jobID string,
) (*IngestionJob, error)

StopIngestionJob stops an ingestion job.

func (*InMemoryBackend) TagResource

func (b *InMemoryBackend) TagResource(
	_ context.Context, resourceARN string, tags map[string]string,
) error

TagResource adds or updates tags on a resource.

func (*InMemoryBackend) UntagResource

func (b *InMemoryBackend) UntagResource(
	_ context.Context, resourceARN string, tagKeys []string,
) error

UntagResource removes tags from a resource.

func (*InMemoryBackend) UpdateAgent

func (b *InMemoryBackend) UpdateAgent(_ context.Context, agentID string, cfg AgentConfig) (*Agent, error)

UpdateAgent updates an existing agent.

func (*InMemoryBackend) UpdateAgentActionGroup

func (b *InMemoryBackend) UpdateAgentActionGroup(
	_ context.Context, agentID, agentVersion, actionGroupID string, cfg ActionGroupConfig,
) (*AgentActionGroup, error)

UpdateAgentActionGroup updates an action group.

func (*InMemoryBackend) UpdateAgentAlias

func (b *InMemoryBackend) UpdateAgentAlias(
	_ context.Context, agentID, aliasID string, cfg AliasConfig,
) (*AgentAlias, error)

UpdateAgentAlias updates an agent alias.

func (*InMemoryBackend) UpdateAgentCollaborator

func (b *InMemoryBackend) UpdateAgentCollaborator(
	_ context.Context, agentID, agentVersion, collaboratorID string, cfg CollaboratorConfig,
) (*AgentCollaborator, error)

UpdateAgentCollaborator updates a collaborator.

func (*InMemoryBackend) UpdateAgentKnowledgeBase

func (b *InMemoryBackend) UpdateAgentKnowledgeBase(
	_ context.Context, agentID, agentVersion, kbID, description, kbState string,
) (*AgentKnowledgeBase, error)

UpdateAgentKnowledgeBase updates an agent–KB association.

func (*InMemoryBackend) UpdateDataSource

func (b *InMemoryBackend) UpdateDataSource(
	_ context.Context, kbID, dsID string, cfg DataSourceConfig,
) (*DataSource, error)

UpdateDataSource updates a data source.

func (*InMemoryBackend) UpdateFlow

func (b *InMemoryBackend) UpdateFlow(_ context.Context, flowID string, cfg FlowConfig) (*Flow, error)

UpdateFlow updates a flow.

func (*InMemoryBackend) UpdateFlowAlias

func (b *InMemoryBackend) UpdateFlowAlias(
	_ context.Context, flowID, aliasID string, cfg FlowAliasConfig,
) (*FlowAlias, error)

UpdateFlowAlias updates a flow alias.

func (*InMemoryBackend) UpdateKnowledgeBase

func (b *InMemoryBackend) UpdateKnowledgeBase(
	_ context.Context, kbID string, cfg KnowledgeBaseConfig,
) (*KnowledgeBase, error)

UpdateKnowledgeBase updates a knowledge base.

func (*InMemoryBackend) UpdatePrompt

func (b *InMemoryBackend) UpdatePrompt(
	_ context.Context, promptID string, cfg PromptConfig,
) (*Prompt, error)

UpdatePrompt updates a prompt.

func (*InMemoryBackend) ValidateFlowDefinition

func (b *InMemoryBackend) ValidateFlowDefinition(
	_ context.Context, _ map[string]any,
) ([]FlowValidationError, error)

ValidateFlowDefinition validates a flow definition (stub - always passes).

type IngestionJob

type IngestionJob struct {
	StartedAt       time.Time               `json:"startedAt"`
	UpdatedAt       time.Time               `json:"updatedAt"`
	Statistics      *IngestionJobStatistics `json:"statistics,omitempty"`
	IngestionJobID  string                  `json:"ingestionJobId"`
	KnowledgeBaseID string                  `json:"knowledgeBaseId"`
	DataSourceID    string                  `json:"dataSourceId"`
	Status          string                  `json:"status"`
	Description     string                  `json:"description,omitempty"`
}

IngestionJob is a knowledge base data ingestion job.

type IngestionJobStatistics added in v1.2.0

type IngestionJobStatistics struct {
	NumberOfDocumentsScanned          int64 `json:"numberOfDocumentsScanned"`
	NumberOfMetadataDocumentsScanned  int64 `json:"numberOfMetadataDocumentsScanned"`
	NumberOfNewDocumentsIndexed       int64 `json:"numberOfNewDocumentsIndexed"`
	NumberOfModifiedDocumentsIndexed  int64 `json:"numberOfModifiedDocumentsIndexed"`
	NumberOfMetadataDocumentsModified int64 `json:"numberOfMetadataDocumentsModified"`
	NumberOfDocumentsDeleted          int64 `json:"numberOfDocumentsDeleted"`
	NumberOfDocumentsFailed           int64 `json:"numberOfDocumentsFailed"`
}

IngestionJobStatistics holds document-count statistics for an ingestion job. Field names match the real aws-sdk-go-v2 wire shape exactly (see awsRestjson1_deserializeDocumentIngestionJobStatistics in the SDK's deserializers.go): plain PrimitiveLong integers, not epoch timestamps.

type KBDocument

type KBDocument struct {
	Metadata map[string]any
	Content  map[string]any
	DocID    string
}

KBDocument is a knowledge base document for ingestion.

type KBDocumentDetail

type KBDocumentDetail struct {
	DocumentID      string `json:"documentId"`
	KnowledgeBaseID string `json:"knowledgeBaseId"`
	DataSourceID    string `json:"dataSourceId"`
	Status          string `json:"status"`
}

KBDocumentDetail is the status of a knowledge base document operation.

type KnowledgeBase

type KnowledgeBase struct {
	CreatedAt            time.Time      `json:"createdAt"`
	UpdatedAt            time.Time      `json:"updatedAt"`
	KBConfiguration      map[string]any `json:"knowledgeBaseConfiguration,omitempty"`
	StorageConfiguration map[string]any `json:"storageConfiguration,omitempty"`
	KnowledgeBaseID      string         `json:"knowledgeBaseId"`
	KnowledgeBaseARN     string         `json:"knowledgeBaseArn"`
	Name                 string         `json:"name"`
	Status               string         `json:"status"`
	Description          string         `json:"description,omitempty"`
	RoleARN              string         `json:"roleArn,omitempty"`
}

KnowledgeBase is a Bedrock Knowledge Base. Tags are deliberately NOT a field here -- the real types.KnowledgeBase has no "tags" member; CreateKnowledgeBase seeds b.tags[KnowledgeBaseARN] directly instead.

type KnowledgeBaseConfig

type KnowledgeBaseConfig struct {
	Tags                 map[string]string
	KBConfiguration      map[string]any
	StorageConfiguration map[string]any
	Name                 string
	Description          string
	RoleARN              string
}

KnowledgeBaseConfig holds fields for creating or updating a KnowledgeBase.

type KnowledgeBaseSummary

type KnowledgeBaseSummary struct {
	UpdatedAt       time.Time `json:"updatedAt"`
	KnowledgeBaseID string    `json:"knowledgeBaseId"`
	Name            string    `json:"name"`
	Status          string    `json:"status"`
	Description     string    `json:"description,omitempty"`
}

KnowledgeBaseSummary is used in list responses.

type Prompt

type Prompt struct {
	CreatedAt      time.Time        `json:"createdAt"`
	UpdatedAt      time.Time        `json:"updatedAt"`
	PromptID       string           `json:"id"`
	PromptARN      string           `json:"arn"`
	Name           string           `json:"name"`
	Description    string           `json:"description,omitempty"`
	DefaultVariant string           `json:"defaultVariant,omitempty"`
	Version        string           `json:"version"`
	Variants       []map[string]any `json:"variants,omitempty"`
}

Prompt is a Bedrock Prompt resource. Tags are deliberately NOT a field here -- the real GetPromptOutput/CreatePromptOutput has no "tags" member; CreatePrompt seeds b.tags[PromptARN] directly instead.

type PromptConfig

type PromptConfig struct {
	Tags           map[string]string
	Name           string
	Description    string
	DefaultVariant string
	Variants       []map[string]any
}

PromptConfig holds fields for creating or updating a Prompt.

type PromptSummary

type PromptSummary struct {
	CreatedAt   time.Time `json:"createdAt"`
	UpdatedAt   time.Time `json:"updatedAt"`
	PromptID    string    `json:"id"`
	PromptARN   string    `json:"arn"`
	Name        string    `json:"name"`
	Description string    `json:"description,omitempty"`
	Version     string    `json:"version"`
}

PromptSummary is used in list responses.

type PromptVersion

type PromptVersion struct {
	CreatedAt   time.Time        `json:"createdAt"`
	PromptARN   string           `json:"arn"`
	PromptID    string           `json:"id"`
	Name        string           `json:"name"`
	Version     string           `json:"version"`
	Description string           `json:"description,omitempty"`
	Variants    []map[string]any `json:"variants,omitempty"`
}

PromptVersion is an immutable snapshot of a prompt.

type Provider

type Provider struct{}

Provider implements service.Provider for the Bedrock Agent service.

func (*Provider) Init

Init initialises the Bedrock Agent backend and handler.

func (*Provider) Name

func (p *Provider) Name() string

Name returns the provider name.

type ResourcePolicy added in v1.2.0

type ResourcePolicy struct {
	CreatedAt   time.Time
	UpdatedAt   time.Time
	ResourceArn string
	Policy      string
	RevisionID  string
}

ResourcePolicy is the resource-based policy attached to a knowledge base (bedrock-agent's PutResourcePolicy/GetResourcePolicy/DeleteResourcePolicy -- see resource_policy.go's package doc comment for why this family is scoped to knowledge bases only). CreatedAt/UpdatedAt are internal bookkeeping only; the real wire response never exposes them (see handler_resource_policy.go's response structs), only "policy"/ "resourceArn"/"revisionId".

type StorageBackend

type StorageBackend interface {
	// Snapshot and Restore implement persistence.Persistable. Handler
	// delegates to them (see persistence.go) so cli.go's generic
	// setupPersistence picks BedrockAgent up. Before Phase 3.3, BedrockAgent
	// had no persistence at all: neither Handler nor InMemoryBackend
	// implemented Snapshot/Restore, so state never survived a restart. This
	// is the dead-wiring fix in scope for the Phase 3.3 datalayer
	// conversion, built from scratch following the codecommit/cleanrooms
	// pattern (see persistence.go).
	Snapshot(ctx context.Context) []byte
	Restore(ctx context.Context, data []byte) error

	// Agent operations.
	CreateAgent(ctx context.Context, cfg AgentConfig) (*Agent, error)
	GetAgent(ctx context.Context, agentID string) (*Agent, error)
	UpdateAgent(ctx context.Context, agentID string, cfg AgentConfig) (*Agent, error)
	DeleteAgent(ctx context.Context, agentID string) error
	ListAgents(ctx context.Context, maxResults int, nextToken string) ([]*AgentSummary, string, error)
	PrepareAgent(ctx context.Context, agentID string) (*Agent, error)

	// Agent version operations.
	CreateAgentVersion(ctx context.Context, agentID, description string) (*AgentVersion, error)
	GetAgentVersion(ctx context.Context, agentID, agentVersion string) (*AgentVersion, error)
	DeleteAgentVersion(ctx context.Context, agentID, agentVersion string) error
	ListAgentVersions(
		ctx context.Context, agentID string, maxResults int, nextToken string,
	) ([]*AgentVersionSummary, string, error)

	// Agent action group operations.
	CreateAgentActionGroup(
		ctx context.Context, agentID, agentVersion string, cfg ActionGroupConfig,
	) (*AgentActionGroup, error)
	GetAgentActionGroup(
		ctx context.Context, agentID, agentVersion, actionGroupID string,
	) (*AgentActionGroup, error)
	UpdateAgentActionGroup(
		ctx context.Context, agentID, agentVersion, actionGroupID string, cfg ActionGroupConfig,
	) (*AgentActionGroup, error)
	DeleteAgentActionGroup(
		ctx context.Context, agentID, agentVersion, actionGroupID string,
	) error
	ListAgentActionGroups(
		ctx context.Context, agentID, agentVersion string, maxResults int, nextToken string,
	) ([]*ActionGroupSummary, string, error)

	// Agent alias operations.
	CreateAgentAlias(ctx context.Context, agentID string, cfg AliasConfig) (*AgentAlias, error)
	GetAgentAlias(ctx context.Context, agentID, agentAliasID string) (*AgentAlias, error)
	UpdateAgentAlias(ctx context.Context, agentID, agentAliasID string, cfg AliasConfig) (*AgentAlias, error)
	DeleteAgentAlias(ctx context.Context, agentID, agentAliasID string) error
	ListAgentAliases(
		ctx context.Context, agentID string, maxResults int, nextToken string,
	) ([]*AgentAliasSummary, string, error)

	// Agent collaborator operations.
	AssociateAgentCollaborator(
		ctx context.Context, agentID, agentVersion string, cfg CollaboratorConfig,
	) (*AgentCollaborator, error)
	GetAgentCollaborator(
		ctx context.Context, agentID, agentVersion, collaboratorID string,
	) (*AgentCollaborator, error)
	UpdateAgentCollaborator(
		ctx context.Context, agentID, agentVersion, collaboratorID string, cfg CollaboratorConfig,
	) (*AgentCollaborator, error)
	DisassociateAgentCollaborator(
		ctx context.Context, agentID, agentVersion, collaboratorID string,
	) error
	ListAgentCollaborators(
		ctx context.Context, agentID, agentVersion string, maxResults int, nextToken string,
	) ([]*AgentCollaborator, string, error)

	// Knowledge base operations.
	CreateKnowledgeBase(ctx context.Context, cfg KnowledgeBaseConfig) (*KnowledgeBase, error)
	GetKnowledgeBase(ctx context.Context, kbID string) (*KnowledgeBase, error)
	UpdateKnowledgeBase(ctx context.Context, kbID string, cfg KnowledgeBaseConfig) (*KnowledgeBase, error)
	DeleteKnowledgeBase(ctx context.Context, kbID string) error
	ListKnowledgeBases(ctx context.Context, maxResults int, nextToken string) ([]*KnowledgeBaseSummary, string, error)

	// Agent–knowledge base association operations.
	AssociateAgentKnowledgeBase(
		ctx context.Context, agentID, agentVersion, kbID, description, kbState string,
	) (*AgentKnowledgeBase, error)
	GetAgentKnowledgeBase(
		ctx context.Context, agentID, agentVersion, kbID string,
	) (*AgentKnowledgeBase, error)
	UpdateAgentKnowledgeBase(
		ctx context.Context, agentID, agentVersion, kbID, description, kbState string,
	) (*AgentKnowledgeBase, error)
	DisassociateAgentKnowledgeBase(
		ctx context.Context, agentID, agentVersion, kbID string,
	) error
	ListAgentKnowledgeBases(
		ctx context.Context, agentID, agentVersion string, maxResults int, nextToken string,
	) ([]*AgentKnowledgeBase, string, error)

	// Data source operations.
	CreateDataSource(ctx context.Context, kbID string, cfg DataSourceConfig) (*DataSource, error)
	GetDataSource(ctx context.Context, kbID, dataSourceID string) (*DataSource, error)
	UpdateDataSource(ctx context.Context, kbID, dataSourceID string, cfg DataSourceConfig) (*DataSource, error)
	DeleteDataSource(ctx context.Context, kbID, dataSourceID string) error
	ListDataSources(
		ctx context.Context, kbID string, maxResults int, nextToken string,
	) ([]*DataSourceSummary, string, error)

	// Ingestion job operations.
	StartIngestionJob(ctx context.Context, kbID, dataSourceID, description string) (*IngestionJob, error)
	GetIngestionJob(ctx context.Context, kbID, dataSourceID, ingestionJobID string) (*IngestionJob, error)
	StopIngestionJob(ctx context.Context, kbID, dataSourceID, ingestionJobID string) (*IngestionJob, error)
	ListIngestionJobs(
		ctx context.Context, kbID, dataSourceID string, maxResults int, nextToken string,
	) ([]*IngestionJob, string, error)

	// Flow operations.
	CreateFlow(ctx context.Context, cfg FlowConfig) (*Flow, error)
	GetFlow(ctx context.Context, flowID string) (*Flow, error)
	UpdateFlow(ctx context.Context, flowID string, cfg FlowConfig) (*Flow, error)
	DeleteFlow(ctx context.Context, flowID string) error
	ListFlows(ctx context.Context, maxResults int, nextToken string) ([]*FlowSummary, string, error)
	PrepareFlow(ctx context.Context, flowID string) (*Flow, error)
	ValidateFlowDefinition(ctx context.Context, definition map[string]any) ([]FlowValidationError, error)

	// Flow version operations.
	CreateFlowVersion(ctx context.Context, flowID, description string) (*FlowVersion, error)
	GetFlowVersion(ctx context.Context, flowID, flowVersion string) (*FlowVersion, error)
	DeleteFlowVersion(ctx context.Context, flowID, flowVersion string) error
	ListFlowVersions(
		ctx context.Context, flowID string, maxResults int, nextToken string,
	) ([]*FlowVersionSummary, string, error)

	// Flow alias operations.
	CreateFlowAlias(ctx context.Context, flowID string, cfg FlowAliasConfig) (*FlowAlias, error)
	GetFlowAlias(ctx context.Context, flowID, aliasID string) (*FlowAlias, error)
	UpdateFlowAlias(ctx context.Context, flowID, aliasID string, cfg FlowAliasConfig) (*FlowAlias, error)
	DeleteFlowAlias(ctx context.Context, flowID, aliasID string) error
	ListFlowAliases(
		ctx context.Context, flowID string, maxResults int, nextToken string,
	) ([]*FlowAliasSummary, string, error)

	// Prompt operations.
	CreatePrompt(ctx context.Context, cfg PromptConfig) (*Prompt, error)
	GetPrompt(ctx context.Context, promptID string) (*Prompt, error)
	UpdatePrompt(ctx context.Context, promptID string, cfg PromptConfig) (*Prompt, error)
	DeletePrompt(ctx context.Context, promptID string) error
	ListPrompts(ctx context.Context, maxResults int, nextToken string) ([]*PromptSummary, string, error)

	// Prompt version operations.
	CreatePromptVersion(ctx context.Context, promptID, description string) (*PromptVersion, error)
	GetPromptVersion(ctx context.Context, promptID, version string) (*PromptVersion, error)
	DeletePromptVersion(ctx context.Context, promptID, version string) error

	// Knowledge base document operations.
	IngestKnowledgeBaseDocuments(
		ctx context.Context, kbID, dataSourceID string, docs []KBDocument,
	) ([]KBDocumentDetail, error)
	GetKnowledgeBaseDocuments(
		ctx context.Context, kbID, dataSourceID string, docIDs []string,
	) ([]KBDocumentDetail, error)
	DeleteKnowledgeBaseDocuments(
		ctx context.Context, kbID, dataSourceID string, docIDs []string,
	) ([]KBDocumentDetail, error)
	ListKnowledgeBaseDocuments(
		ctx context.Context, kbID, dataSourceID string, maxResults int, nextToken string,
	) ([]KBDocumentDetail, string, error)

	// Tagging operations.
	ListTagsForResource(ctx context.Context, resourceARN string) (map[string]string, error)
	TagResource(ctx context.Context, resourceARN string, tags map[string]string) error
	UntagResource(ctx context.Context, resourceARN string, tagKeys []string) error

	// Resource policy operations (knowledge bases only -- see
	// resource_policy.go's package doc comment).
	PutResourcePolicy(ctx context.Context, resourceArn, policy, expectedRevisionID string) (*ResourcePolicy, error)
	GetResourcePolicy(ctx context.Context, resourceArn string) (*ResourcePolicy, error)
	DeleteResourcePolicy(ctx context.Context, resourceArn, expectedRevisionID string) (string, error)
}

StorageBackend defines all persistence operations for the Bedrock Agent service.

Jump to

Keyboard shortcuts

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