{"id":3032,"library":"mypy-boto3-bedrock-agent","title":"mypy-boto3-bedrock-agent","description":"mypy-boto3-bedrock-agent provides type annotations (stubs) for the `boto3` Bedrock Agent service, enhancing static type checking with tools like Mypy. It is part of the `mypy-boto3` ecosystem, which generates stubs for all `boto3` services. The library follows the `boto3` release cycle closely, with frequent updates to ensure compatibility with the latest AWS SDK features and API changes. Current version is 1.42.83.","status":"active","version":"1.42.83","language":"en","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["AWS","Boto3","Type Hinting","Mypy","Bedrock"],"install":[{"cmd":"pip install mypy-boto3-bedrock-agent boto3","lang":"bash","label":"Install with boto3"}],"dependencies":[{"reason":"Provides the runtime functionality for AWS SDK. This package only provides type stubs.","package":"boto3","optional":false}],"imports":[{"symbol":"BedrockAgentClient","correct":"from mypy_boto3_bedrock_agent import BedrockAgentClient"},{"note":"Both import paths are typically valid, the first is often preferred for brevity.","symbol":"BedrockAgentClient","correct":"from mypy_boto3_bedrock_agent.client import BedrockAgentClient"}],"quickstart":{"code":"import os\nimport boto3\nfrom mypy_boto3_bedrock_agent import BedrockAgentClient\nfrom botocore.exceptions import ClientError\n\n# Ensure boto3 is installed and configured (e.g., via AWS environment variables\n# AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION, or IAM roles).\n# For local testing, ensure these are set or provide dummy values.\n\n# Type hint the client to enable static analysis by Mypy\n# region_name is typically required for Bedrock services.\nclient: BedrockAgentClient = boto3.client(\n    \"bedrock-agent\",\n    region_name=os.environ.get(\"AWS_REGION\", \"us-east-1\")\n)\n\ntry:\n    # Example operation: List existing agents\n    print(\"Attempting to list Bedrock Agents...\")\n    response = client.list_agents(maxResults=5)\n    \n    agents = response.get(\"agentSummaries\", [])\n    if agents:\n        print(\"Successfully listed agents:\")\n        for agent_summary in agents:\n            print(f\"  - Agent ID: {agent_summary['agentId']}, Name: {agent_summary['agentName']}\")\n    else:\n        print(\"No Bedrock agents found in this region.\")\n\nexcept ClientError as e:\n    error_code = e.response.get(\"Error\", {}).get(\"Code\")\n    error_message = e.response.get(\"Error\", {}).get(\"Message\")\n    if error_code == \"AccessDeniedException\":\n        print(f\"Access Denied: You might not have permissions to list agents. Error: {error_message}\")\n    else:\n        print(f\"An AWS Client Error occurred: {error_code} - {error_message}\")\nexcept Exception as e:\n    print(f\"An unexpected error occurred: {e}\")\n\n# Mypy will now correctly type-check method calls on `client`\n# and the structure of `response` based on the AWS API definition.","lang":"python","description":"This quickstart demonstrates how to instantiate a `bedrock-agent` client with type hints from `mypy-boto3-bedrock-agent` and perform a basic operation (`list_agents`). It highlights how the stubs provide static type checking for `boto3` client methods and their responses."},"warnings":[{"fix":"Upgrade your Python environment to 3.9 or a later version.","message":"Support for Python 3.8 has been removed. Projects using `mypy-boto3-bedrock-agent` (and other `mypy-boto3` generated stubs) must use Python 3.9 or newer.","severity":"breaking","affected_versions":">=8.12.0 of mypy-boto3-builder (corresponds to mypy-boto3-bedrock-agent >=1.42.83)"},{"fix":"Review your code for any direct references to `boto3` TypeDefs and adjust their names according to the new conventions. Refer to the specific service's `TypeDefs` for updated names.","message":"TypeDef naming conventions were changed in `mypy-boto3-builder`, potentially affecting direct references to generated TypeDefs. For example, `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef` and `CreateDistributionExtraRequestTypeDef` became `CreateDistributionRequestExtraTypeDef`.","severity":"breaking","affected_versions":">=8.9.0 of mypy-boto3-builder (corresponds to mypy-boto3-bedrock-agent versions after approximately 1.30.x)"},{"fix":"Ensure `boto3` is included in your project's dependencies (e.g., `pip install boto3`).","message":"This package provides *only* type annotations (stubs). `boto3` itself must be installed and available at runtime for your application to function correctly.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Install `boto3-stubs` (or `mypy-boto3` for legacy projects) for comprehensive `boto3` type checking, or install specific `mypy-boto3-{service_name}` packages for each service you use.","message":"Installing `mypy-boto3-bedrock-agent` only provides stubs for the `bedrock-agent` service. If you use other `boto3` services (e.g., S3, EC2), you will need to install their respective `mypy-boto3-*` packages, or install the overarching `boto3-stubs` package for full coverage.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}