AWS Cloudformation Bedrock
giuseppe-trisciuoglio/developer-kit
Provides AWS CloudFormation patterns for Amazon Bedrock resources including agents, knowledge bases, data sources, guardrails, prompts, flows, and inference profiles.
Amazon Bedrock Agents for building autonomous AI agents with foundation model orchestration, action groups, knowledge bases, and session management.
$ npx skills add majiayu000/claude-skill-registry --skill bedrock-agents -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install majiayu000/claude-skill-registry bedrock-agents --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/majiayu000/claude-skill-registry.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/agent/bedrock-agents .claude/skills/bedrock-agents && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "bedrock-agents" agent skill from https://github.com/majiayu000/claude-skill-registry/tree/main/skills/agent/bedrock-agents into .claude/skills/bedrock-agents/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "bedrock-agents", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/majiayu000/claude-skill-registry/tree/main/skills/agent/bedrock-agentsType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add majiayu000/claude-skill-registry --skill bedrock-agents -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install majiayu000/claude-skill-registry bedrock-agents --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/majiayu000/claude-skill-registry.git skills-src && mkdir -p .agents/skills && cp -r skills-src/skills/agent/bedrock-agents .agents/skills/bedrock-agents && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "bedrock-agents" agent skill from https://github.com/majiayu000/claude-skill-registry/tree/main/skills/agent/bedrock-agents into .agents/skills/bedrock-agents/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "bedrock-agents", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add majiayu000/claude-skill-registry --skill bedrock-agents -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install majiayu000/claude-skill-registry bedrock-agents --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/majiayu000/claude-skill-registry.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/skills/agent/bedrock-agents .cursor/skills/bedrock-agents && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "bedrock-agents" agent skill from https://github.com/majiayu000/claude-skill-registry/tree/main/skills/agent/bedrock-agents into .cursor/skills/bedrock-agents/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "bedrock-agents", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/majiayu000/claude-skill-registry.git --path skills/agent/bedrock-agents--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add majiayu000/claude-skill-registry --skill bedrock-agents -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install majiayu000/claude-skill-registry bedrock-agents --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/majiayu000/claude-skill-registry.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/skills/agent/bedrock-agents .gemini/skills/bedrock-agents && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "bedrock-agents" agent skill from https://github.com/majiayu000/claude-skill-registry/tree/main/skills/agent/bedrock-agents into .gemini/skills/bedrock-agents/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "bedrock-agents", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install majiayu000/claude-skill-registry bedrock-agentsInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add majiayu000/claude-skill-registry --skill bedrock-agents -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/majiayu000/claude-skill-registry.git skills-src && mkdir -p .github/skills && cp -r skills-src/skills/agent/bedrock-agents .github/skills/bedrock-agents && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "bedrock-agents" agent skill from https://github.com/majiayu000/claude-skill-registry/tree/main/skills/agent/bedrock-agents into .github/skills/bedrock-agents/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "bedrock-agents", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add majiayu000/claude-skill-registry --skill bedrock-agents -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install majiayu000/claude-skill-registry bedrock-agents --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/majiayu000/claude-skill-registry.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/skills/agent/bedrock-agents .opencode/skills/bedrock-agents && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "bedrock-agents" agent skill from https://github.com/majiayu000/claude-skill-registry/tree/main/skills/agent/bedrock-agents into .opencode/skills/bedrock-agents/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "bedrock-agents", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
bedrock-agentsAmazon Bedrock Agents for building autonomous AI agents with foundation model orchestration, action groups, knowledge bases, and session management.
Bedrock Agents is an agent skill from majiayu000/claude-skill-registry. Amazon Bedrock Agents for building autonomous AI agents with foundation model orchestration, action groups, knowledge bases, and session management. Use when creating AI agents, orchestrating multi-step workflows, integrating tools with LLMs, building conversational agents, implementing RAG patterns, managing agent sessions, deploying production agents, or connecting knowledge bases to agents.
Its SKILL.md is about 10k tokens, which your agent loads only when the skill is triggered. The skill folder holds 1 other file (for example `metadata.json`).
It sits in Knowledge Management, covering Knowledge bases, Authentication and Retrieval-augmented generation. It works with Amazon Bedrock and AWS Lambda. The repository describes itself as: Searchable Claude Code skills catalog with source-linked guides and generated registry artifacts. The licence is MIT.
12 steps, taken from the step headings in SKILL.md.
Read from SKILL.md and the folder at commit 2d14a69. It shows what the files ask for, not the result of running them.
Pre-approves these tools, so the agent can use them without asking each time:
BashReadWriteEditGlobGrepFrom allowed-tools in the SKILL.md frontmatter.
No scripts in the folder and no shell commands in SKILL.md (its code samples are python).
From the folder's file list and the shell code blocks in SKILL.md.
Links to these hosts (documentation or services it may open):
docs.aws.amazon.comFrom URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Bedrock Agents loads about 10k tokens when it runs. Until then it costs about 103 tokens; SKILL.md has 541 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check noted patterns worth knowing about, such as sudo or a known installer.
allowed-tools: Bash, Read, Write, Edit, Glob, GrepAutomated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from majiayu000/claude-skill-registry at commit 2d14a69, republished under its MIT licence (© majiayu000). 541 words, ~10,283 tokens.
.claude/skills/bedrock-agents/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.Complete guide to building and managing Amazon Bedrock Agents - autonomous AI agents that orchestrate foundation models with action groups, knowledge bases, and multi-turn conversations.
Amazon Bedrock Agents enables you to create autonomous AI agents that can:
Control Plane: bedrock-agent client for agent configuration
Runtime Plane: bedrock-agent-runtime client for agent invocation
The foundation model orchestrator that processes requests, plans actions, and coordinates responses.
Key Properties:
Define tools and APIs the agent can invoke to accomplish tasks.
Types:
Vector databases with RAG capabilities that agents can query.
Integration:
Versioned endpoints for agent deployment.
Benefits:
Maintain conversation context across multiple invocations.
Session Management:
┌─────────────────────────────────────────────────────────────┐
│ Application Layer │
│ (Your code using bedrock-agent-runtime.invoke_agent) │
└───────────────────────────┬─────────────────────────────────┘
│
┌───────────────────────────▼─────────────────────────────────┐
│ Bedrock Agent Runtime │
│ - Session management │
│ - Streaming responses │
│ - Trace/reasoning visibility │
└───────┬──────────────────┬──────────────────┬───────────────┘
│ │ │
┌───────▼────────┐ ┌─────▼──────┐ ┌────────▼──────────┐
│ Foundation │ │ Action │ │ Knowledge │
│ Model │ │ Groups │ │ Bases │
│ (Claude, etc.) │ │ (Lambda, │ │ (Vector DB + │
│ │ │ OpenAPI) │ │ Documents) │
└────────────────┘ └────────────┘ └───────────────────┘Create a new Bedrock Agent with foundation model and instructions.
boto3 Example:
import boto3
import json
bedrock_agent = boto3.client('bedrock-agent', region_name='us-east-1')
def create_agent(
agent_name: str,
foundation_model: str = "anthropic.claude-3-5-sonnet-20241022-v2:0",
instructions: str = None,
description: str = None,
idle_session_ttl: int = 600
) -> dict:
"""
Create a Bedrock Agent.
Args:
agent_name: Name of the agent
foundation_model: Model ID (Claude 3.5 Sonnet, Haiku, etc.)
instructions: System prompt defining agent behavior
description: Human-readable description
idle_session_ttl: Session timeout in seconds (default 600)
Returns:
Agent details including agentId, agentArn, agentStatus
"""
# Default instructions if none provided
if instructions is None:
instructions = """You are a helpful AI assistant.
Follow user requests carefully and provide accurate, helpful responses.
When you need to use tools or access knowledge, do so to provide better answers."""
try:
response = bedrock_agent.create_agent(
agentName=agent_name,
foundationModel=foundation_model,
instruction=instructions,
description=description or f"Bedrock Agent: {agent_name}",
idleSessionTTLInSeconds=idle_session_ttl,
# Optional: Add tags
tags={
'Environment': 'production',
'ManagedBy': 'bedrock-agents-skill'
}
)
agent = response['agent']
print(f"✓ Created agent: {agent['agentName']}")
print(f" Agent ID: {agent['agentId']}")
print(f" Status: {agent['agentStatus']}")
print(f" Foundation Model: {agent['foundationModel']}")
return agent
except Exception as e:
print(f"✗ Failed to create agent: {str(e)}")
raise
# Example: Create customer support agent
agent = create_agent(
agent_name="customer-support-agent",
foundation_model="anthropic.claude-3-5-sonnet-20241022-v2:0",
instructions="""You are a customer support agent for an e-commerce platform.
Your responsibilities:
- Answer customer questions about orders, products, and policies
- Look up order status using available tools
- Provide accurate information from the knowledge base
- Be helpful, professional, and empathetic
Always verify information before providing answers.
If you cannot help, escalate to a human agent.""",
description="AI-powered customer support agent",
idle_session_ttl=1800 # 30 minutes
)
agent_id = agent['agentId']Foundation Models:
anthropic.claude-3-5-sonnet-20241022-v2:0 - Best reasoninganthropic.claude-3-5-haiku-20241022-v1:0 - Fast responsesanthropic.claude-3-opus-20240229-v1:0 - Maximum capabilityamazon.titan-text-premier-v1:0 - AWS native modelPrepare the agent for use (required after creation or updates).
def prepare_agent(agent_id: str) -> dict:
"""
Prepare agent for use. Required after creation or configuration changes.
Args:
agent_id: ID of the agent to prepare
Returns:
Prepared agent details
"""
try:
response = bedrock_agent.prepare_agent(agentId=agent_id)
print(f"✓ Agent preparation started")
print(f" Agent ID: {agent_id}")
print(f" Status: {response['agentStatus']}")
print(f" Prepared At: {response['preparedAt']}")
return response
except Exception as e:
print(f"✗ Failed to prepare agent: {str(e)}")
raise
# Prepare the agent
prepare_agent(agent_id)
# Wait for preparation to complete
import time
def wait_for_agent_ready(agent_id: str, max_wait: int = 120):
"""Wait for agent to be in PREPARED or VERSIONED status."""
start_time = time.time()
while time.time() - start_time < max_wait:
response = bedrock_agent.get_agent(agentId=agent_id)
status = response['agent']['agentStatus']
if status in ['PREPARED', 'VERSIONED']:
print(f"✓ Agent ready (status: {status})")
return True
elif status == 'FAILED':
print(f"✗ Agent preparation failed")
return False
print(f" Waiting for agent... (status: {status})")
time.sleep(5)
print(f"✗ Timeout waiting for agent")
return False
wait_for_agent_ready(agent_id)Add Lambda or OpenAPI action groups to enable tool use.
Lambda Action Group:
def create_lambda_action_group(
agent_id: str,
action_group_name: str,
lambda_arn: str,
description: str,
api_schema: dict
) -> dict:
"""
Create an action group that invokes Lambda functions.
Args:
agent_id: ID of the agent
action_group_name: Name of the action group
lambda_arn: ARN of the Lambda function to invoke
description: Description of what this action group does
api_schema: OpenAPI schema defining available operations
Returns:
Action group details
"""
try:
response = bedrock_agent.create_agent_action_group(
agentId=agent_id,
agentVersion='DRAFT',
actionGroupName=action_group_name,
description=description,
actionGroupExecutor={
'lambda': lambda_arn
},
apiSchema={
'payload': json.dumps(api_schema)
},
actionGroupState='ENABLED'
)
action_group = response['agentActionGroup']
print(f"✓ Created action group: {action_group['actionGroupName']}")
print(f" Action Group ID: {action_group['actionGroupId']}")
print(f" Lambda: {lambda_arn}")
return action_group
except Exception as e:
print(f"✗ Failed to create action group: {str(e)}")
raise
# Example: Order lookup action group
order_lookup_schema = {
"openapi": "3.0.0",
"info": {
"title": "Order Management API",
"version": "1.0.0",
"description": "APIs for looking up and managing customer orders"
},
"paths": {
"/orders/{order_id}": {
"get": {
"summary": "Get order details",
"description": "Retrieve detailed information about a specific order",
"operationId": "getOrderDetails",
"parameters": [
{
"name": "order_id",
"in": "path",
"description": "The unique order identifier",
"required": True,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Order details",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"order_id": {"type": "string"},
"status": {"type": "string"},
"total": {"type": "number"},
"items": {"type": "array"}
}
}
}
}
}
}
}
},
"/orders/search": {
"post": {
"summary": "Search orders",
"description": "Search for orders by customer email or date range",
"operationId": "searchOrders",
"requestBody": {
"required": True,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"customer_email": {"type": "string"},
"start_date": {"type": "string", "format": "date"},
"end_date": {"type": "string", "format": "date"}
}
}
}
}
},
"responses": {
"200": {
"description": "List of matching orders"
}
}
}
}
}
}
action_group = create_lambda_action_group(
agent_id=agent_id,
action_group_name="order-management",
lambda_arn="arn:aws:lambda:us-east-1:123456789012:function:order-lookup",
description="Look up and search customer orders",
api_schema=order_lookup_schema
)OpenAPI Action Group (External REST API):
def create_openapi_action_group(
agent_id: str,
action_group_name: str,
api_schema: dict,
description: str
) -> dict:
"""
Create an action group for external REST APIs.
Agent will make HTTP requests to the API defined in the schema.
"""
try:
response = bedrock_agent.create_agent_action_group(
agentId=agent_id,
agentVersion='DRAFT',
actionGroupName=action_group_name,
description=description,
actionGroupExecutor={
'customControl': 'RETURN_CONTROL' # Return to application for execution
},
apiSchema={
'payload': json.dumps(api_schema)
},
actionGroupState='ENABLED'
)
return response['agentActionGroup']
except Exception as e:
print(f"✗ Failed to create OpenAPI action group: {str(e)}")
raiseConnect a knowledge base to enable RAG capabilities.
def associate_knowledge_base(
agent_id: str,
knowledge_base_id: str,
description: str = "Agent knowledge base"
) -> dict:
"""
Associate a knowledge base with an agent for RAG.
Args:
agent_id: ID of the agent
knowledge_base_id: ID of the knowledge base to associate
description: Description of the knowledge base purpose
Returns:
Association details
"""
try:
response = bedrock_agent.associate_agent_knowledge_base(
agentId=agent_id,
agentVersion='DRAFT',
knowledgeBaseId=knowledge_base_id,
description=description,
knowledgeBaseState='ENABLED'
)
kb = response['agentKnowledgeBase']
print(f"✓ Associated knowledge base")
print(f" Knowledge Base ID: {kb['knowledgeBaseId']}")
print(f" Description: {kb['description']}")
return kb
except Exception as e:
print(f"✗ Failed to associate knowledge base: {str(e)}")
raise
# Associate knowledge base with agent
kb_association = associate_knowledge_base(
agent_id=agent_id,
knowledge_base_id="KB123456789",
description="Product catalog and FAQ knowledge base"
)
# After association, prepare agent again
prepare_agent(agent_id)
wait_for_agent_ready(agent_id)Create a stable endpoint for agent invocation.
def create_agent_alias(
agent_id: str,
alias_name: str,
description: str = None
) -> dict:
"""
Create an agent alias for deployment.
Args:
agent_id: ID of the agent
alias_name: Name for the alias (e.g., 'production', 'staging')
description: Description of the alias
Returns:
Alias details including agentAliasId
"""
try:
response = bedrock_agent.create_agent_alias(
agentId=agent_id,
agentAliasName=alias_name,
description=description or f"{alias_name} environment"
)
alias = response['agentAlias']
print(f"✓ Created alias: {alias['agentAliasName']}")
print(f" Alias ID: {alias['agentAliasId']}")
print(f" Status: {alias['agentAliasStatus']}")
return alias
except Exception as e:
print(f"✗ Failed to create alias: {str(e)}")
raise
# Create production alias
alias = create_agent_alias(
agent_id=agent_id,
alias_name="production",
description="Production environment for customer support agent"
)
agent_alias_id = alias['agentAliasId']
# Wait for alias to be ready
def wait_for_alias_ready(agent_id: str, alias_id: str, max_wait: int = 120):
"""Wait for alias to be in PREPARED status."""
start_time = time.time()
while time.time() - start_time < max_wait:
response = bedrock_agent.get_agent_alias(
agentId=agent_id,
agentAliasId=alias_id
)
status = response['agentAlias']['agentAliasStatus']
if status == 'PREPARED':
print(f"✓ Alias ready")
return True
elif status == 'FAILED':
print(f"✗ Alias preparation failed")
return False
print(f" Waiting for alias... (status: {status})")
time.sleep(5)
return False
wait_for_alias_ready(agent_id, agent_alias_id)Invoke the agent with single-turn or multi-turn conversations.
Single-Turn Invocation:
import boto3
bedrock_agent_runtime = boto3.client('bedrock-agent-runtime', region_name='us-east-1')
def invoke_agent(
agent_id: str,
agent_alias_id: str,
session_id: str,
input_text: str,
enable_trace: bool = True
) -> dict:
"""
Invoke a Bedrock Agent with streaming response.
Args:
agent_id: ID of the agent
agent_alias_id: ID of the agent alias
session_id: Unique session ID for conversation tracking
input_text: User's input text
enable_trace: Enable trace for reasoning visibility
Returns:
Complete response with text, traces, and citations
"""
try:
response = bedrock_agent_runtime.invoke_agent(
agentId=agent_id,
agentAliasId=agent_alias_id,
sessionId=session_id,
inputText=input_text,
enableTrace=enable_trace
)
# Process streaming response
result = {
'completion': '',
'traces': [],
'citations': []
}
event_stream = response['completion']
for event in event_stream:
if 'chunk' in event:
chunk = event['chunk']
if 'bytes' in chunk:
text = chunk['bytes'].decode('utf-8')
result['completion'] += text
print(text, end='', flush=True)
elif 'trace' in event:
trace = event['trace']['trace']
result['traces'].append(trace)
# Print reasoning steps
if enable_trace:
if 'orchestrationTrace' in trace:
orch = trace['orchestrationTrace']
if 'rationale' in orch:
print(f"\n[Reasoning] {orch['rationale']['text']}")
if 'invocationInput' in orch:
print(f"[Action] {orch['invocationInput']}")
elif 'returnControl' in event:
# Handle return of control for action group execution
result['return_control'] = event['returnControl']
print("\n")
return result
except Exception as e:
print(f"✗ Failed to invoke agent: {str(e)}")
raise
# Example: Single-turn invocation
import uuid
session_id = str(uuid.uuid4())
response = invoke_agent(
agent_id=agent_id,
agent_alias_id=agent_alias_id,
session_id=session_id,
input_text="What's the status of order #12345?",
enable_trace=True
)
print(f"\nAgent Response: {response['completion']}")Multi-Turn Conversation:
def chat_with_agent(
agent_id: str,
agent_alias_id: str,
enable_trace: bool = False
):
"""
Interactive chat session with the agent.
Maintains conversation context across turns.
"""
session_id = str(uuid.uuid4())
print(f"Chat session started (ID: {session_id})")
print("Type 'exit' to end the conversation\n")
while True:
user_input = input("You: ").strip()
if user_input.lower() in ['exit', 'quit', 'bye']:
print("Ending conversation...")
break
if not user_input:
continue
print("\nAgent: ", end='', flush=True)
response = invoke_agent(
agent_id=agent_id,
agent_alias_id=agent_alias_id,
session_id=session_id,
input_text=user_input,
enable_trace=enable_trace
)
print() # New line after response
# Start interactive chat
# chat_with_agent(agent_id, agent_alias_id, enable_trace=False)Invoke with Session State:
def invoke_agent_with_state(
agent_id: str,
agent_alias_id: str,
session_id: str,
input_text: str,
session_state: dict = None
) -> dict:
"""
Invoke agent with custom session state.
Session state can include:
- promptSessionAttributes: Dynamic variables for prompts
- sessionAttributes: Persistent session data
"""
invoke_params = {
'agentId': agent_id,
'agentAliasId': agent_alias_id,
'sessionId': session_id,
'inputText': input_text
}
if session_state:
invoke_params['sessionState'] = session_state
response = bedrock_agent_runtime.invoke_agent(**invoke_params)
# Process response...
result = {'completion': ''}
for event in response['completion']:
if 'chunk' in event and 'bytes' in event['chunk']:
result['completion'] += event['chunk']['bytes'].decode('utf-8')
return result
# Example: Pass customer context
response = invoke_agent_with_state(
agent_id=agent_id,
agent_alias_id=agent_alias_id,
session_id=session_id,
input_text="What's my order status?",
session_state={
'sessionAttributes': {
'customer_id': 'CUST-12345',
'customer_tier': 'premium',
'customer_email': 'user@example.com'
},
'promptSessionAttributes': {
'current_date': '2025-12-05',
'support_level': 'tier1'
}
}
)Clear conversation memory for a session.
def delete_agent_memory(
agent_id: str,
agent_alias_id: str,
session_id: str
) -> dict:
"""
Delete conversation memory for a specific session.
Args:
agent_id: ID of the agent
agent_alias_id: ID of the agent alias
session_id: Session ID to clear
Returns:
Deletion confirmation
"""
try:
response = bedrock_agent_runtime.delete_agent_memory(
agentId=agent_id,
agentAliasId=agent_alias_id,
memoryId=session_id
)
print(f"✓ Deleted agent memory for session: {session_id}")
return response
except Exception as e:
print(f"✗ Failed to delete memory: {str(e)}")
raise
# Clear session memory
delete_agent_memory(agent_id, agent_alias_id, session_id)Update agent configuration, instructions, or foundation model.
def update_agent(
agent_id: str,
agent_name: str = None,
instructions: str = None,
foundation_model: str = None,
description: str = None
) -> dict:
"""
Update agent configuration.
After update, must prepare agent again before use.
"""
try:
# Get current agent details
current = bedrock_agent.get_agent(agentId=agent_id)['agent']
update_params = {
'agentId': agent_id,
'agentName': agent_name or current['agentName'],
'foundationModel': foundation_model or current['foundationModel'],
'instruction': instructions or current.get('instruction', '')
}
if description:
update_params['description'] = description
response = bedrock_agent.update_agent(**update_params)
print(f"✓ Updated agent: {response['agent']['agentName']}")
print(" Note: Prepare agent before use")
return response['agent']
except Exception as e:
print(f"✗ Failed to update agent: {str(e)}")
raise
# Update agent instructions
update_agent(
agent_id=agent_id,
instructions="""You are an enhanced customer support agent.
New capabilities:
- Proactively suggest related products
- Offer discounts for service issues
- Escalate complex cases to supervisors
Maintain professional, empathetic tone."""
)
# Prepare after update
prepare_agent(agent_id)
wait_for_agent_ready(agent_id)Manage agent lifecycle.
def list_agents() -> list:
"""List all agents in the account."""
try:
response = bedrock_agent.list_agents(maxResults=50)
agents = response.get('agentSummaries', [])
print(f"Found {len(agents)} agents:")
for agent in agents:
print(f"\n Name: {agent['agentName']}")
print(f" ID: {agent['agentId']}")
print(f" Status: {agent['agentStatus']}")
print(f" Updated: {agent['updatedAt']}")
return agents
except Exception as e:
print(f"✗ Failed to list agents: {str(e)}")
raise
def delete_agent(agent_id: str, skip_resource_in_use_check: bool = False) -> dict:
"""
Delete an agent and all associated resources.
Args:
agent_id: ID of the agent to delete
skip_resource_in_use_check: Skip check for aliases
"""
try:
response = bedrock_agent.delete_agent(
agentId=agent_id,
skipResourceInUseCheck=skip_resource_in_use_check
)
print(f"✓ Deleted agent: {agent_id}")
print(f" Status: {response['agentStatus']}")
return response
except Exception as e:
print(f"✗ Failed to delete agent: {str(e)}")
raise
# List all agents
agents = list_agents()
# Delete specific agent
# delete_agent(agent_id, skip_resource_in_use_check=True)Simple question answering without multi-turn context.
def single_turn_query(agent_id: str, agent_alias_id: str, query: str) -> str:
"""
Execute a single query without conversation context.
Each invocation is independent.
"""
# Use unique session ID for each request
session_id = str(uuid.uuid4())
response = bedrock_agent_runtime.invoke_agent(
agentId=agent_id,
agentAliasId=agent_alias_id,
sessionId=session_id,
inputText=query,
enableTrace=False
)
completion = ''
for event in response['completion']:
if 'chunk' in event and 'bytes' in event['chunk']:
completion += event['chunk']['bytes'].decode('utf-8')
return completion
# Example: Independent queries
answer1 = single_turn_query(agent_id, agent_alias_id, "What's your refund policy?")
answer2 = single_turn_query(agent_id, agent_alias_id, "How long does shipping take?")Maintain context across multiple exchanges.
class ConversationSession:
"""Manage a multi-turn conversation with context."""
def __init__(self, agent_id: str, agent_alias_id: str):
self.agent_id = agent_id
self.agent_alias_id = agent_alias_id
self.session_id = str(uuid.uuid4())
self.history = []
def send_message(self, message: str) -> str:
"""Send a message and get response."""
response = bedrock_agent_runtime.invoke_agent(
agentId=self.agent_id,
agentAliasId=self.agent_alias_id,
sessionId=self.session_id,
inputText=message
)
completion = ''
for event in response['completion']:
if 'chunk' in event and 'bytes' in event['chunk']:
completion += event['chunk']['bytes'].decode('utf-8')
self.history.append({'user': message, 'agent': completion})
return completion
def reset(self):
"""Clear conversation memory."""
bedrock_agent_runtime.delete_agent_memory(
agentId=self.agent_id,
agentAliasId=self.agent_alias_id,
memoryId=self.session_id
)
self.history = []
# Example: Multi-turn conversation
conversation = ConversationSession(agent_id, agent_alias_id)
response1 = conversation.send_message("I need to return a product")
response2 = conversation.send_message("It's order #12345")
response3 = conversation.send_message("The item was damaged on arrival")
# Agent maintains context: knows we're talking about order #12345Agent retrieves information from knowledge base.
def rag_query(agent_id: str, agent_alias_id: str, query: str) -> dict:
"""
Query agent with RAG capabilities.
Returns response with citations from knowledge base.
"""
session_id = str(uuid.uuid4())
response = bedrock_agent_runtime.invoke_agent(
agentId=agent_id,
agentAliasId=agent_alias_id,
sessionId=session_id,
inputText=query,
enableTrace=True
)
result = {
'answer': '',
'citations': [],
'retrieved_docs': []
}
for event in response['completion']:
if 'chunk' in event and 'bytes' in event['chunk']:
result['answer'] += event['chunk']['bytes'].decode('utf-8')
elif 'trace' in event:
trace = event['trace']['trace']
# Extract knowledge base retrieval
if 'orchestrationTrace' in trace:
orch = trace['orchestrationTrace']
if 'observation' in orch:
obs = orch['observation']
if 'knowledgeBaseLookupOutput' in obs:
kb_output = obs['knowledgeBaseLookupOutput']
result['retrieved_docs'].extend(
kb_output.get('retrievedReferences', [])
)
return result
# Example: Query with citations
result = rag_query(
agent_id,
agent_alias_id,
"What are the ingredients in the protein powder?"
)
print(f"Answer: {result['answer']}")
print(f"\nRetrieved {len(result['retrieved_docs'])} documents")
for doc in result['retrieved_docs']:
print(f" - {doc['content']['text'][:100]}...")Agent invokes tools to accomplish tasks.
def tool_use_example(agent_id: str, agent_alias_id: str, request: str):
"""
Agent uses action groups to invoke tools.
Demonstrates tool invocation flow.
"""
session_id = str(uuid.uuid4())
response = bedrock_agent_runtime.invoke_agent(
agentId=agent_id,
agentAliasId=agent_alias_id,
sessionId=session_id,
inputText=request,
enableTrace=True
)
for event in response['completion']:
if 'trace' in event:
trace = event['trace']['trace']
if 'orchestrationTrace' in trace:
orch = trace['orchestrationTrace']
# Agent planning
if 'rationale' in orch:
print(f"[Planning] {orch['rationale']['text']}")
# Agent invoking tool
if 'invocationInput' in orch:
inv = orch['invocationInput']
if 'actionGroupInvocationInput' in inv:
action = inv['actionGroupInvocationInput']
print(f"[Tool Call] {action['actionGroupName']}")
print(f" API: {action.get('apiPath', 'N/A')}")
print(f" Parameters: {action.get('parameters', {})}")
# Tool result
if 'observation' in orch:
obs = orch['observation']
if 'actionGroupInvocationOutput' in obs:
output = obs['actionGroupInvocationOutput']
print(f"[Tool Result] {output.get('text', '')}")
elif 'chunk' in event and 'bytes' in event['chunk']:
text = event['chunk']['bytes'].decode('utf-8')
print(text, end='', flush=True)
# Example: Agent uses tools
tool_use_example(
agent_id,
agent_alias_id,
"Find all orders for customer@example.com in the last 30 days"
)Write clear, specific instructions:
good_instructions = """You are a financial advisor agent for retail banking customers.
Your capabilities:
- Answer questions about savings accounts, checking accounts, and credit cards
- Look up account balances and transaction history using available tools
- Provide information about loan products from the knowledge base
- Help customers understand fees and policies
Your guidelines:
- Always verify customer identity before accessing account information
- Provide accurate information from official sources only
- If you cannot help with something, explain why and suggest alternatives
- Use professional but friendly language
- Cite sources when providing policy or fee information
Your limitations:
- You cannot make transactions or transfer money
- You cannot change account settings
- You cannot access accounts without proper verification
- For complex issues, escalate to a human advisor
Session context:
- Customer tier: {{customer_tier}}
- Customer since: {{customer_since}}
- Primary account: {{primary_account_type}}
"""Track sessions appropriately:
# Single-turn: New session per request
session_id = str(uuid.uuid4())
# Multi-turn: Persistent session ID
session_id = f"user-{user_id}-{datetime.now().strftime('%Y%m%d')}"
# Long-running: Include timestamp
session_id = f"support-ticket-{ticket_id}-{int(time.time())}"
# Clear old sessions periodically
def cleanup_old_sessions(agent_id: str, agent_alias_id: str, session_ids: list):
"""Delete memory for expired sessions."""
for session_id in session_ids:
try:
bedrock_agent_runtime.delete_agent_memory(
agentId=agent_id,
agentAliasId=agent_alias_id,
memoryId=session_id
)
except:
pass # Session may not existHandle streaming errors gracefully:
def invoke_agent_safe(agent_id: str, agent_alias_id: str, session_id: str, input_text: str):
"""Invoke agent with comprehensive error handling."""
try:
response = bedrock_agent_runtime.invoke_agent(
agentId=agent_id,
agentAliasId=agent_alias_id,
sessionId=session_id,
inputText=input_text
)
completion = ''
for event in response['completion']:
try:
if 'chunk' in event and 'bytes' in event['chunk']:
completion += event['chunk']['bytes'].decode('utf-8')
elif 'internalServerException' in event:
raise Exception("Internal server error")
elif 'validationException' in event:
raise ValueError("Validation error")
elif 'throttlingException' in event:
raise Exception("Rate limit exceeded")
except Exception as e:
print(f"Stream error: {str(e)}")
continue
return completion
except bedrock_agent_runtime.exceptions.ResourceNotFoundException:
print("Agent or alias not found")
raise
except bedrock_agent_runtime.exceptions.AccessDeniedException:
print("Access denied - check IAM permissions")
raise
except Exception as e:
print(f"Invocation error: {str(e)}")
raiseStructure Lambda functions for action groups:
# Lambda function for order lookup action group
def lambda_handler(event, context):
"""
Handle action group invocations from Bedrock Agent.
Event structure:
{
'actionGroup': 'order-management',
'apiPath': '/orders/{order_id}',
'httpMethod': 'GET',
'parameters': [...]
}
"""
action_group = event['actionGroup']
api_path = event['apiPath']
http_method = event['httpMethod']
# Parse parameters
parameters = {}
for param in event.get('parameters', []):
parameters[param['name']] = param['value']
# Route to handler
if api_path == '/orders/{order_id}' and http_method == 'GET':
return get_order_details(parameters.get('order_id'))
elif api_path == '/orders/search' and http_method == 'POST':
return search_orders(parameters)
else:
return {
'statusCode': 404,
'body': {'error': 'Operation not found'}
}
def get_order_details(order_id: str):
"""Get order details from database."""
# Query database...
order = {
'order_id': order_id,
'status': 'shipped',
'total': 129.99,
'items': [
{'name': 'Widget', 'quantity': 2, 'price': 49.99},
{'name': 'Gadget', 'quantity': 1, 'price': 30.01}
],
'tracking': 'TRACK123456'
}
return {
'statusCode': 200,
'body': order
}Track agent performance:
import logging
logger = logging.getLogger()
logger.setLevel(logging.INFO)
def invoke_agent_with_metrics(agent_id: str, agent_alias_id: str, session_id: str, input_text: str):
"""Invoke agent with logging and metrics."""
start_time = time.time()
logger.info(f"Agent invocation started: {agent_id}")
logger.info(f"Session: {session_id}")
logger.info(f"Input: {input_text[:100]}...")
try:
response = bedrock_agent_runtime.invoke_agent(
agentId=agent_id,
agentAliasId=agent_alias_id,
sessionId=session_id,
inputText=input_text,
enableTrace=True
)
completion = ''
tool_calls = 0
kb_retrievals = 0
for event in response['completion']:
if 'chunk' in event and 'bytes' in event['chunk']:
completion += event['chunk']['bytes'].decode('utf-8')
elif 'trace' in event:
trace = event['trace']['trace']
if 'orchestrationTrace' in trace:
orch = trace['orchestrationTrace']
if 'invocationInput' in orch:
inv = orch['invocationInput']
if 'actionGroupInvocationInput' in inv:
tool_calls += 1
if 'observation' in orch:
obs = orch['observation']
if 'knowledgeBaseLookupOutput' in obs:
kb_retrievals += 1
duration = time.time() - start_time
logger.info(f"Agent invocation completed")
logger.info(f"Duration: {duration:.2f}s")
logger.info(f"Tool calls: {tool_calls}")
logger.info(f"KB retrievals: {kb_retrievals}")
logger.info(f"Response length: {len(completion)} chars")
return {
'completion': completion,
'metrics': {
'duration': duration,
'tool_calls': tool_calls,
'kb_retrievals': kb_retrievals
}
}
except Exception as e:
duration = time.time() - start_time
logger.error(f"Agent invocation failed after {duration:.2f}s: {str(e)}")
raise© majiayu000, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
SKILL.md and 1 other file in skills/agent/bedrock-agents of majiayu000/claude-skill-registry.
Open the folder on GitHubat commit 2d14a69
We found 4 copies of this SKILL.md (exact, near-identical or edited) in other folders, from 1 other GitHub owner. This page covers the copy in majiayu000/claude-skill-registry, which our catalogue first saw on October 7, 2026.
Bedrock Agents next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Bedrock Agents this skillmajiayu000/claude-skill-registry | 666 | 1 repos | ~10k | Automated safety check: Notes | MIT | |
| AWS Cloudformation Bedrockgiuseppe-trisciuoglio/developer-kit | 355 | — | ~3.2k | Automated safety check: Notes | MIT | |
| Amazon Bedrockaws/agent-toolkit-for-aws | 2.8k | — | ~8.6k | Automated safety check: Pass | Apache-2.0 | |
| Gnogmickel/gno | 115 | 1 repos | ~1.6k | Automated safety check: Pass | MIT | |
| Gnogmickel/gno | 115 | — | ~11k | Automated safety check: Pass | MIT | |
| Azure Search Documents TSmicrosoft/skills | 3.1k | — | ~1.8k | Automated safety check: Pass | MIT |
giuseppe-trisciuoglio/developer-kit
Provides AWS CloudFormation patterns for Amazon Bedrock resources including agents, knowledge bases, data sources, guardrails, prompts, flows, and inference profiles.
aws/agent-toolkit-for-aws
Builds generative AI applications on Amazon Bedrock. An agent skill from aws/agent-toolkit-for-aws.
gmickel/gno
Search local documents, files, notes, and knowledge bases. An agent skill from gmickel/gno.
gmickel/gno
Search local documents, files, notes, and knowledge bases. An agent skill from gmickel/gno.
microsoft/skills
Build search applications using Azure AI Search SDK for JavaScript (@azure/search-documents).
sundial-org/awesome-openclaw-skills
Search and retrieve markdown documents from local knowledge bases using qmd.
majiayu000/claude-skill-registry
Multi-source deep research using firecrawl and exa MCPs. An agent skill from majiayu000/claude-skill-registry.
majiayu000/claude-skill-registry
Neural search via Exa MCP for web, code, and company research.
majiayu000/claude-skill-registry
Unified media generation via fal.ai MCP — image, video, and audio.
majiayu000/claude-skill-registry
Interact with Zotero reference management libraries using the pyzotero Python client.
majiayu000/claude-skill-registry
Search scientific papers and retrieve structured experimental data extracted from full-text studies via the BGPT MCP server.
majiayu000/claude-skill-registry
Perform pairwise sequence alignment using Biopython Bio.Align.PairwiseAligner.
Works with
Categories
Amazon Bedrock Agents for building autonomous AI agents with foundation model orchestration, action groups, knowledge bases, and session management. Bedrock Agents is an agent skill from majiayu000/claude-skill-registry. Amazon Bedrock Agents for building autonomous AI agents with foundation model orchestration, action groups, knowledge bases, and session management.
Bedrock Agents fits situations like: creating AI agents; orchestrating multi-step workflows; integrating tools with LLMs; building conversational agents.
Run `npx skills add majiayu000/claude-skill-registry --skill bedrock-agents -a claude-code`. Or copy the skill folder (skills/agent/bedrock-agents in majiayu000/claude-skill-registry) into .claude/skills/bedrock-agents in your project. Claude Code loads it when a task matches its description.
Run `npx skills add majiayu000/claude-skill-registry --skill bedrock-agents -a codex`. Or copy the skill folder (skills/agent/bedrock-agents in majiayu000/claude-skill-registry) into .agents/skills/bedrock-agents in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add majiayu000/claude-skill-registry --skill bedrock-agents -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/bedrock-agents, .gemini/skills/bedrock-agents, .github/skills/bedrock-agents and .opencode/skills/bedrock-agents in your project.
SKILL.md names no scripts, command-line tools or credentials: Bedrock Agents is instructions for the agent only. Our summary lists: Python 3. Its frontmatter pre-approves these tools: Bash, Read, Write, Edit, Glob, Grep.
SKILL.md names 1 domain. As links in the text: docs.aws.amazon.com. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found notes only (pre-approves every shell command (allowed-tools: bash)), nothing it rates as a warning. It is not a guarantee. Review the folder before installing.
Bedrock Agents is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 10k tokens (SKILL.md is roughly 41k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.
Skills that share tags, products or a category with Bedrock Agents: AWS Cloudformation Bedrock (giuseppe-trisciuoglio/developer-kit, 355 stars), Amazon Bedrock (aws/agent-toolkit-for-aws, 2.8k stars), Gno (gmickel/gno, 115 stars) and Gno (gmickel/gno, 115 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
majiayu000 (a GitHub user) maintains it in majiayu000/claude-skill-registry, which has 666 GitHub stars. The repository holds 1,273 skills in this directory. The repository was last updated on October 7, 2026.
Source: majiayu000/claude-skill-registry on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.