This agent provides an interactive communication channel to query an analyze documentation stored in Backstage.
- For each document entry in
Backstage s3 bucketthere is a correspondentsearch_index.jsonthat contains all document data. The data insearch_index.jsonis split in chunks (one per subheading). Content Creator function reads the file and assembles those chunks together. It also adds backstage links that point to the correspondent subheadings. The resulted document is stored inBedrock S3 bucket. - Bedrock has an option to build a
Knowledge Basefrom the documents (which is essentially RAG). The build process works as follows:- The
Knowledge Base agenttakes a document form the s3 bucket and pipes it thoroughamazon.titan-embed-text-v1model to generate a vector representation of the document text. - The
Knowledge Base agentthen stores this vector together with the document text in OpenSearch asinverted indexfor the later use.
- The
- The
Bedrock Agentis a middle man that processes user requests. The flow looks as follows:- The user sends a query to the
Bedrock Agent. - The
Bedrock Agentpipes the query throughamazon.titan-embed-text-v1model to generate a vector representation of the query. - The
Bedrock Agentthen sends this vector to OpenSearch to find the most similar documents. - The found documents and the query are piped through
anthropic.claude-3-5-sonnet-20240620-v1:0to get an answer. - The
Bedrock Agenthas a set of preconfigured actions that it can perform by invoking Action Performer lambda function. For example, it can check that Backstage links are not broken before returning them to the user.
- The user sends a query to the
- Thechdocs is deployed following Recommended Deployment guide and AWS S3 used as a storage. If the bucket is located in another account, then
s3:ListBucketands3:GetObjectpermissions should be granted for the target account. - Bedrock models are enabled and allowed in the target AWS Account. Namely
amazon.titan-embed-text-v1andanthropic.claude-3-5-sonnet-20240620-v1:0are used.
The backend is built with CDK using Amplify.
To deploy a sandboxed version of the agent, execute from the root:
SOURCE_BUCKET_NAME=<your_s3_bucket_name> BACKSTAGE_URL=<your_backstage.url> npx ampx sandbox