This tool integrates AWS Bedrock foundation models to perform model invocation, embedding generation, and RAG configuration.

Install

mkdir -p .claude/skills/bedrock && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/3405" && unzip -o skill.zip -d .claude/skills/bedrock && rm skill.zip

Installs to .claude/skills/bedrock

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

AWS Bedrock foundation models for generative AI. Use when invoking foundation models, building AI applications, creating embeddings, configuring model access, or implementing RAG patterns.
188 chars✓ has a “when” trigger
Intermediate

Key capabilities

  • Invoke foundation models
  • Generate vector embeddings
  • Stream model responses
  • Manage multi-turn conversations
  • List and query available models

How it works

The tool interfaces with the AWS Bedrock API to send prompts to foundation models and receive generated content or embeddings, supporting both synchronous and streaming modes.

Inputs & outputs

You give it
Prompt text or data for embedding
You get back
Generated text or vector embedding

When to use bedrock

  • Invoking text models
  • Generating vector embeddings
  • Building RAG applications

About this skill

AWS Bedrock

Amazon Bedrock provides access to foundation models (FMs) from AI companies through a unified API. Build generative AI applications with text generation, embeddings, and image generation capabilities.

Table of Contents

Core Concepts

Foundation Models

Pre-trained models available through Bedrock:

  • Claude (Anthropic): Text generation, analysis, coding
  • Titan (Amazon): Text, embeddings, image generation
  • Llama (Meta): Open-weight text generation
  • Mistral: Efficient text generation
  • Stable Diffusion (Stability AI): Image generation

Model Access

Models must be enabled in your account before use:

  • Request access in Bedrock console
  • Some models require acceptance of EULAs
  • Access is region-specific

Inference Types

TypeUse CasePricing
On-DemandVariable workloadsPer token
Provisioned ThroughputConsistent high-volumeHourly commitment
Batch InferenceAsync large-scaleDiscounted per token

Common Patterns

Invoke Model (Text Generation)

AWS CLI:

# Invoke Claude
aws bedrock-runtime invoke-model \
  --model-id anthropic.claude-3-sonnet-20240229-v1:0 \
  --content-type application/json \
  --accept application/json \
  --body '{
    "anthropic_version": "bedrock-2023-05-31",
    "max_tokens": 1024,
    "messages": [
      {"role": "user", "content": "Explain AWS Lambda in 3 sentences."}
    ]
  }' \
  response.json

cat response.json | jq -r '.content[0].text'

boto3:

import boto3
import json

bedrock = boto3.client('bedrock-runtime')

def invoke_claude(prompt, max_tokens=1024):
    response = bedrock.invoke_model(
        modelId='anthropic.claude-3-sonnet-20240229-v1:0',
        contentType='application/json',
        accept='application/json',
        body=json.dumps({
            'anthropic_version': 'bedrock-2023-05-31',
            'max_tokens': max_tokens,
            'messages': [
                {'role': 'user', 'content': prompt}
            ]
        })
    )

    result = json.loads(response['body'].read())
    return result['content'][0]['text']

# Usage
response = invoke_claude('What is Amazon S3?')
print(response)

Streaming Response

import boto3
import json

bedrock = boto3.client('bedrock-runtime')

def stream_claude(prompt):
    response = bedrock.invoke_model_with_response_stream(
        modelId='anthropic.claude-3-sonnet-20240229-v1:0',
        contentType='application/json',
        accept='application/json',
        body=json.dumps({
            'anthropic_version': 'bedrock-2023-05-31',
            'max_tokens': 1024,
            'messages': [
                {'role': 'user', 'content': prompt}
            ]
        })
    )

    for event in response['body']:
        chunk = json.loads(event['chunk']['bytes'])
        if chunk['type'] == 'content_block_delta':
            yield chunk['delta'].get('text', '')

# Usage
for text in stream_claude('Write a haiku about cloud computing.'):
    print(text, end='', flush=True)

Generate Embeddings

import boto3
import json

bedrock = boto3.client('bedrock-runtime')

def get_embedding(text):
    response = bedrock.invoke_model(
        modelId='amazon.titan-embed-text-v2:0',
        contentType='application/json',
        accept='application/json',
        body=json.dumps({
            'inputText': text,
            'dimensions': 1024,
            'normalize': True
        })
    )

    result = json.loads(response['body'].read())
    return result['embedding']

# Usage
embedding = get_embedding('AWS Lambda is a serverless compute service.')
print(f'Embedding dimension: {len(embedding)}')

Conversation with History

import boto3
import json

bedrock = boto3.client('bedrock-runtime')

class Conversation:
    def __init__(self, system_prompt=None):
        self.messages = []
        self.system = system_prompt

    def chat(self, user_message):
        self.messages.append({
            'role': 'user',
            'content': user_message
        })

        body = {
            'anthropic_version': 'bedrock-2023-05-31',
            'max_tokens': 1024,
            'messages': self.messages
        }

        if self.system:
            body['system'] = self.system

        response = bedrock.invoke_model(
            modelId='anthropic.claude-3-sonnet-20240229-v1:0',
            contentType='application/json',
            accept='application/json',
            body=json.dumps(body)
        )

        result = json.loads(response['body'].read())
        assistant_message = result['content'][0]['text']

        self.messages.append({
            'role': 'assistant',
            'content': assistant_message
        })

        return assistant_message

# Usage
conv = Conversation(system_prompt='You are an AWS solutions architect.')
print(conv.chat('What database should I use for a chat application?'))
print(conv.chat('What about for time-series data?'))

List Available Models

# List all foundation models
aws bedrock list-foundation-models \
  --query 'modelSummaries[*].[modelId,modelName,providerName]' \
  --output table

# Filter by provider
aws bedrock list-foundation-models \
  --by-provider anthropic \
  --query 'modelSummaries[*].modelId'

# Get model details
aws bedrock get-foundation-model \
  --model-identifier anthropic.claude-3-sonnet-20240229-v1:0

Request Model Access

# List model access status
aws bedrock list-foundation-model-agreement-offers \
  --model-id anthropic.claude-3-sonnet-20240229-v1:0

CLI Reference

Bedrock (Control Plane)

CommandDescription
aws bedrock list-foundation-modelsList available models
aws bedrock get-foundation-modelGet model details
aws bedrock list-custom-modelsList fine-tuned models
aws bedrock create-model-customization-jobStart fine-tuning
aws bedrock list-provisioned-model-throughputsList provisioned capacity

Bedrock Runtime (Data Plane)

CommandDescription
aws bedrock-runtime invoke-modelInvoke model synchronously
aws bedrock-runtime invoke-model-with-response-streamInvoke with streaming
aws bedrock-runtime converseMulti-turn conversation API
aws bedrock-runtime converse-streamStreaming conversation

Bedrock Agent Runtime

CommandDescription
aws bedrock-agent-runtime invoke-agentInvoke a Bedrock agent
aws bedrock-agent-runtime retrieveQuery knowledge base
aws bedrock-agent-runtime retrieve-and-generateRAG query

Best Practices

Cost Optimization

  • Use appropriate models: Smaller models for simple tasks
  • Set max_tokens: Limit output length when possible
  • Cache responses: For repeated identical queries
  • Batch when possible: Use batch inference for bulk processing
  • Monitor usage: Set up CloudWatch alarms for cost

Performance

  • Use streaming: For better user experience with long outputs
  • Connection pooling: Reuse boto3 clients
  • Regional deployment: Use closest region to reduce latency
  • Provisioned throughput: For consistent high-volume workloads

Security

  • Least privilege IAM: Only grant needed model access
  • VPC endpoints: Keep traffic private
  • Guardrails: Implement content filtering
  • Audit with CloudTrail: Track model invocations

IAM Permissions

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "bedrock:InvokeModel",
        "bedrock:InvokeModelWithResponseStream"
      ],
      "Resource": [
        "arn:aws:bedrock:us-east-1::foundation-model/anthropic.claude-3-sonnet-20240229-v1:0",
        "arn:aws:bedrock:us-east-1::foundation-model/amazon.titan-embed-text-v2:0"
      ]
    }
  ]
}

Troubleshooting

AccessDeniedException

Causes:

  • Model access not enabled in console
  • IAM policy missing bedrock:InvokeModel
  • Wrong model ID or region

Debug:

# Check model access status
aws bedrock list-foundation-models \
  --query 'modelSummaries[?modelId==`anthropic.claude-3-sonnet-20240229-v1:0`]'

# Test IAM permissions
aws iam simulate-principal-policy \
  --policy-source-arn arn:aws:iam::123456789012:role/my-role \
  --action-names bedrock:InvokeModel \
  --resource-arns "arn:aws:bedrock:us-east-1::foundation-model/anthropic.claude-3-sonnet-20240229-v1:0"

ModelNotReadyException

Cause: Model is still being provisioned or temporarily unavailable.

Solution: Implement retry with exponential backoff:

import time
from botocore.exceptions import ClientError

def invoke_with_retry(bedrock, body, max_retries=3):
    for attempt in range(max_retries):
        try:
            return bedrock.invoke_model(
                modelId='anthropic.claude-3-sonnet-20240229-v1:0',
                body=json.dumps(body)
            )
        except ClientError as e:
            if e.response['Error']['Code'] == 'ModelNotReadyException':
                time.sleep(2 ** attempt)
            else:
                raise
    raise Exception('Max retries exceeded')

ThrottlingException

Causes:

  • Exceeded on-demand quota
  • Too many concurrent requests

Solutions:

  • Request quota increase
  • Implement exponential backoff
  • Consider provisioned throughput

ValidationException

Common issues:

  • Invalid model ID
  • Malformed request body
  • max_tokens exceeds model limit

Debug:

# Check model-specific requirements
aws bedrock get-foundation-model \
  --model-identifier anthropic.claude-3-sonnet-20240229-v1:0 \
  --quer

---

*Content truncated.*

When not to use it

  • When local model execution is required
  • When AWS region-specific model access is not configured

Prerequisites

AWS account with Bedrock model access enabledIAM permissions for bedrock:InvokeModel

Limitations

  • Model access is region-specific
  • Subject to AWS service quotas and throttling
  • Requires explicit IAM configuration

How it compares

It provides a unified interface for multiple foundation models via AWS infrastructure, rather than managing individual model provider APIs.

Compared to similar skills

bedrock side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
bedrock (this skill)17moReviewIntermediate
langchain268moReviewIntermediate
reasoningbank-with-agentdb59moReviewIntermediate
agent-memory-systems56moNo flagsAdvanced

Try saying

Example prompts that trigger this skill in your AI assistant.

You might also like

langchain

zechenzhangAGI

Framework for building LLM-powered applications with agents, chains, and RAG. Supports multiple providers (OpenAI, Anthropic, Google), 500+ integrations, ReAct agents, tool calling, memory management, and vector store retrieval. Use for building chatbots, question-answering systems, autonomous agents, or RAG applications. Best for rapid prototyping and production deployments.

26138

reasoningbank-with-agentdb

ruvnet

Implement ReasoningBank adaptive learning with AgentDB's 150x faster vector database. Includes trajectory tracking, verdict judgment, memory distillation, and pattern recognition. Use when building self-learning agents, optimizing decision-making, or implementing experience replay systems.

579

agent-memory-systems

davila7

Memory is the cornerstone of intelligent agents. Without it, every interaction starts from zero. This skill covers the architecture of agent memory: short-term (context window), long-term (vector stores), and the cognitive architectures that organize them. Key insight: Memory isn't just storage - it's retrieval. A million stored facts mean nothing if you can't find the right one. Chunking, embedding, and retrieval strategies determine whether your agent remembers or forgets. The field is fragm

543

senior-ml-engineer

davila7

World-class ML engineering skill for productionizing ML models, MLOps, and building scalable ML systems. Expertise in PyTorch, TensorFlow, model deployment, feature stores, model monitoring, and ML infrastructure. Includes LLM integration, fine-tuning, RAG systems, and agentic AI. Use when deploying ML models, building ML platforms, implementing MLOps, or integrating LLMs into production systems.

634

dspy

davila7

Build complex AI systems with declarative programming, optimize prompts automatically, create modular RAG systems and agents with DSPy - Stanford NLP's framework for systematic LM programming

430

ai-engineer

sickn33

Build production-ready LLM applications, advanced RAG systems, and intelligent agents. Implements vector search, multimodal AI, agent orchestration, and enterprise AI integrations. Use PROACTIVELY for LLM features, chatbots, AI agents, or AI-powered applications.

725

Search skills

Search the agent skills registry