Skip to content

opensite-ai/opensite-skills / amazon-bedrock

amazon-bedrock

Flagged

Builds generative AI applications on Amazon Bedrock. Covers model invocation (Converse API, InvokeModel), RAG with Knowledge Bases, Bedrock Agents, Guardrails, and AgentCore (including the Harness managed agent loop). Applies when invoking models, setting up Knowledge Bases, creating agents, applying guardrails, deploying to AgentCore, migrating/porting/converting a Bedrock Agent (including inline agents) to an AgentCore Harness, troubleshooting Bedrock errors (ThrottlingException, AccessDeniedException), or choosing Bedrock models (Claude, Llama, Nova, Titan). Also for prompt caching, quota and throttling diagnosis, cost tracking, migrating between Claude model generations, chunking strategies, and Bedrock model selection. Covers AgentCore Payments (x402, microtransactions, Payment Manager, Connector, Instrument, Coinbase CDP, Stripe Privy, paid endpoints, agent payments). NOT for custom model training, Rekognition, or Comprehend. For SageMaker model discovery, customization, or endpoints, use aws-ai-ml.

FileKindSize
.aws-skill-metadataother18 B
SKILL.mdskill md34.1 KB
assets/kb_shim.py.tmplother3.4 KB
assets/lambda_shim.py.tmplother8.0 KB
assets/tool_schema.json.tmplother389 B
references/agentcore-credentials-and-security.mdmarkdown6.5 KB
references/agentcore-gateway.mdmarkdown7.0 KB
references/agentcore-harness.mdmarkdown22.0 KB
references/agentcore-memory-observability.mdmarkdown5.6 KB
references/agentcore-payments-setup-script.mdmarkdown12.3 KB
references/agentcore-payments-wiring.mdmarkdown12.1 KB
references/agentcore-payments.mdmarkdown19.5 KB
references/agentcore-registry-evaluations.mdmarkdown6.8 KB
references/agentcore-runtime-container-build.mdmarkdown10.4 KB
references/agentcore-runtime.mdmarkdown7.6 KB
references/agents-and-action-groups.mdmarkdown16.5 KB
references/bedrock-agents-to-agentcore-harness/cli.mdmarkdown2.0 KB
references/bedrock-agents-to-agentcore-harness/deploy.mdmarkdown12.0 KB
references/bedrock-agents-to-agentcore-harness/discovery.mdmarkdown3.9 KB
references/bedrock-agents-to-agentcore-harness/eligibility.mdmarkdown3.3 KB
references/bedrock-agents-to-agentcore-harness/mapping.mdmarkdown8.9 KB
references/cost-tracking.mdmarkdown4.5 KB
references/guardrails.mdmarkdown14.7 KB
references/knowledge-bases-decision-guide.mdmarkdown2.8 KB
references/knowledge-bases-retrieval.mdmarkdown8.3 KB
references/knowledge-bases-setup.mdmarkdown17.9 KB
references/managed-knowledge-bases-retrieval.mdmarkdown8.1 KB
references/managed-knowledge-bases-setup.mdmarkdown12.7 KB
references/migrate-bedrock-agents-to-agentcore-harness.mdmarkdown11.5 KB
references/model-invocation.mdmarkdown11.0 KB
references/model-migration.mdmarkdown4.3 KB
references/model-selection-guide.mdmarkdown7.4 KB
references/prompt-caching.mdmarkdown5.5 KB
references/prompt-engineering-by-model.mdmarkdown7.9 KB
references/quota-health.mdmarkdown4.3 KB
references/sdk-converse-api-python.mdmarkdown6.3 KB
references/sdk-converse-api-typescript.mdmarkdown6.5 KB
scripts/fetch_bedrock_agent.pyscript14.1 KB

assets/kb_shim.py.tmpl

View on GitHub
"""
Knowledge Base shim Lambda — AgentCore Gateway target.

WHY: the native Gateway KB connector only takes a MANAGED Bedrock KB and a fixed
retrieval contract. For VECTOR / KENDRA / SQL KBs, or to preserve a managed KB's
non-default retrieval config (reranker, metadata filter, hybrid override, top-k),
expose retrieval as this Lambda: it presents one MCP tool, calls
`bedrock-agent-runtime:Retrieve` against the source KB, and returns MCP-shaped
passages.

Gateway invokes a Lambda target with the tool arguments flat in `event` and the
tool name in context.client_context.custom['bedrockAgentCoreToolName']
("<target>___<tool>"). The handler also tolerates a direct {"query": ...} for local
testing.
"""
# <<< RENDER: delete this whole block after substituting the tokens below.
#   {{KB_ID}}        - the source knowledge base id
#   {{TOP_K}}        - numberOfResults from the source KB association (default 5)
#   {{SEARCH_TYPE}}  - "HYBRID" | "SEMANTIC" | "" (empty means KB default)
# <<< /RENDER
import boto3

# Rendered at migration time — the Gateway lambda code target has no
# environment-variable support, so all config is baked in as literals.
_KB_ID = "{{KB_ID}}"
_TOP_K = int("{{TOP_K}}")
_SEARCH_TYPE = "{{SEARCH_TYPE}}".strip().upper()
_MAX_QUERY_LEN = 1000  # reject oversized queries — abuse / runaway retrieval cost

_runtime = boto3.client("bedrock-agent-runtime")


def _vector_search_config():
    cfg = {"numberOfResults": _TOP_K}
    if _SEARCH_TYPE in ("HYBRID", "SEMANTIC"):
        cfg["overrideSearchType"] = _SEARCH_TYPE
    # <<< OPTIONAL: metadata_filter
    # Render the source KB association's `filter` here when present.
    # cfg["filter"] = {{METADATA_FILTER_JSON}}
    # <<< /OPTIONAL: metadata_filter
    # <<< OPTIONAL: reranking
    # Render the source KB association's `rerankingConfiguration` here when present.
    # (Set on retrievalConfiguration, not vectorSearchConfiguration — see the
    #  bedrock-agent-runtime Retrieve API shape.)
    # <<< /OPTIONAL: reranking
    return cfg


def lambda_handler(event, context):
    # single-tool target: Gateway passes the tool args flat in `event`
    args = event if isinstance(event, dict) else {}
    query = args.get("query") or args.get("text") or ""
    if not isinstance(query, str) or not query:
        return {"error": "Missing required argument 'query'."}
    if len(query) > _MAX_QUERY_LEN:
        return {"error": f"Query exceeds {_MAX_QUERY_LEN} chars."}

    vector_cfg = _vector_search_config()
    max_results = args.get("max_results")
    if isinstance(max_results, int) and max_results > 0:
        vector_cfg["numberOfResults"] = max_results

    resp = _runtime.retrieve(
        knowledgeBaseId=_KB_ID,
        retrievalQuery={"text": query},
        retrievalConfiguration={"vectorSearchConfiguration": vector_cfg},
    )
    # Returns KB passage text + source location verbatim. If the KB holds
    # sensitive data (PII, financial records), review what it returns and redact
    # or filter fields here before returning, and keep this Lambda's CloudWatch
    # log group KMS-encrypted (see references/deploy.md) — do not log full passages.
    results = [
        {
            "text": r.get("content", {}).get("text", ""),
            "source": r.get("location", {}),
            "score": r.get("score"),
        }
        for r in resp.get("retrievalResults", [])
    ]
    return {"results": results, "count": len(results)}
writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deploymentStars: 322kUpdated Claude CodeCodexVerifiedInstall
xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy.Stars: 119kUpdated Claude CodeCodexVerifiedInstall
childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release.Stars: 118kUpdated Claude CodeCodexVerifiedInstall