This article presents a unified AI agent architecture leveraging Amazon DynamoDB's native vector search capability to store both operational data and vector embeddings within a single table. This approach simplifies data management, reduces infrastructure complexity, and enhances data consistency for AI-powered applications like knowledge management platforms. The architecture integrates Amazon Bedrock for agent orchestration and AWS Lambda for action groups and embedding generation.
Read original on AWS Architecture BlogTraditionally, building AI agents on AWS often involved fragmented data architectures where operational data (e.g., document metadata) resided in Amazon DynamoDB, and vector embeddings for semantic search were stored in a separate vector database. This led to increased costs, synchronization challenges, and potential data staleness. The introduction of native vector search in DynamoDB addresses these issues by allowing embeddings to be stored directly alongside operational data.
The proposed architecture unifies these data types within a single DynamoDB table. Here's a breakdown of the core components and their interactions:
Single-Table Design Considerations for Vector Search
When designing your DynamoDB table for vector search, consider using a composite primary key and a `SearchSchema` HASH attribute with moderate cardinality for optimal performance. For multi-tenant systems, `tenant_id` is often a good choice. DynamoDB vector indexes require on-demand capacity mode and support up to five indexes per table with up to 4,096 dimensions each. Remember that `SearchVectors` responses are limited to 16 MB and do not support pagination, so project only necessary attributes and keep `TopK` modest.
aws dynamodb update-table \
--table-name unified-agent-data \
--stream-specification StreamEnabled=true,StreamViewType=NEW_AND_OLD_IMAGES \
--attribute-definitions \
AttributeName=category,AttributeType=S \
--vector-index-updates \
'[{"Create": { "IndexName": "content-embedding-index", "VectorAttribute": {"AttributeName": "embedding"}, "Dimensions": 1024, "DistanceFunction": "COSINE", "SearchSchema": [ {"AttributeName": "category", "SearchSchemaElementType": "HASH"} ], "Projection": {"ProjectionType": "INCLUDE", "NonKeyAttributes": ["title", "category"]} }}]'