Registry /
type-stubs / mypy-boto3-bedrock-agentcore
Install & Compatibility
Where this runs
tested against v1.43.83 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.712s · 52.3MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 3.8s · import 0.662s · 53MB
51MB installed
● package 51MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
BedrockAgentCoreClient
✓ from mypy_boto3_bedrock_agentcore import BedrockAgentCoreClient
✗ from boto3.client import BedrockAgentCore
This imports the runtime client without type annotations. The stub package provides the explicit `BedrockAgentCoreClient` type.
ListAgentsResponseTypeDef
✓ from mypy_boto3_bedrock_agentcore.type_defs import ListAgentsResponseTypeDef
Imports specific TypedDicts for request/response bodies, paginators, and other service-specific structures for precise type checking.
This quickstart demonstrates how to instantiate a type-hinted BedrockAgentCore client using `boto3` and perform a basic `list_agents` operation. It includes explicit type annotations for the client and response, which static analysis tools will leverage for improved code completion and error checking. The `TYPE_CHECKING` block prevents the type stub package from being a runtime dependency.
import boto3
from typing import TYPE_CHECKING, List
import os
# These imports are only for type checking, not for runtime execution
if TYPE_CHECKING:
from mypy_boto3_bedrock_agentcore import BedrockAgentCoreClient
from mypy_boto3_bedrock_agentcore.type_defs import AgentSummaryTypeDef, ListAgentsResponseTypeDef
def get_bedrock_agent_core_client() -> "BedrockAgentCoreClient":
"""
Returns a type-hinted BedrockAgentCore client.
"""
# boto3.client returns a botocore.client.BedrockAgentCore instance,
# which mypy-boto3 stubs enhance with static type information.
# Ensure AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, and AWS_REGION are set as environment variables
client: BedrockAgentCoreClient = boto3.client(
"bedrock-agent-core",
region_name=os.environ.get('AWS_REGION', 'us-east-1') # Default region if not set
)
return client
def list_bedrock_agents():
"""
Lists Bedrock Agents with type hints.
"""
client = get_bedrock_agent_core_client()
print("Listing Bedrock Agents...")
try:
# The response is type-checked against ListAgentsResponseTypeDef
response: ListAgentsResponseTypeDef = client.list_agents()
agents: List[AgentSummaryTypeDef] = response.get("agentSummaries", [])
if agents:
for agent in agents:
print(f" Agent Name: {agent.get('agentName')}, Status: {agent.get('agentStatus')}")
else:
print(" No Bedrock Agents found in the configured region.")
except Exception as e:
print(f"Error listing agents: {e}")
if __name__ == "__main__":
# Example of setting environment variables (replace with your actual credentials/region)
# os.environ['AWS_ACCESS_KEY_ID'] = 'YOUR_ACCESS_KEY'
# os.environ['AWS_SECRET_ACCESS_KEY'] = 'YOUR_SECRET_KEY'
# os.environ['AWS_REGION'] = 'us-east-1'
# This will attempt to use credentials from environment variables, ~/.aws/credentials, or IAM role.
list_bedrock_agents()
Debug
Known issues
breakingPython 3.8 support has been removed in `mypy-boto3-builder` version 8.12.0, which generates these type stubs. Projects using `mypy-boto3-bedrock-agentcore` will no longer be type-checked or compatible with Python 3.8 environments.fixUpgrade your project's Python interpreter to version 3.9 or newer.
affects: mypy-boto3-builder >=8.12.0 (and generated packages like mypy-boto3-bedrock-agentcore 1.42.87+)
breakingType definition (TypeDef) names for packed method arguments were shortened in `mypy-boto3-builder` version 8.9.0. This change might break existing type hints if you were explicitly importing and using these TypeDefs (e.g., `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`).fixUpdate TypeDef names in your code to reflect the new, shorter naming conventions. Refer to the specific service's `type_defs` module for the correct names.
affects: mypy-boto3-builder >=8.9.0 (and generated packages)
gotchaFor full auto-completion and type checking benefits, especially in IDEs like VSCode or PyCharm, it is highly recommended to explicitly annotate the return type of `boto3.client()` calls with the specific `mypy-boto3` client class.fixExplicitly declare the client type, e.g., `client: BedrockAgentCoreClient = boto3.client('bedrock-agent-core')`. affects: All versions
gotchaWhen using `if TYPE_CHECKING:` guards to avoid runtime dependency on `mypy-boto3` packages, Pylint might incorrectly report undefined variables. The `mypy-boto3` documentation provides a workaround.fixIn the `else` block of `if TYPE_CHECKING:`, set the aliased types to `object` to satisfy Pylint. For example: `if TYPE_CHECKING: from mypy_boto3_ec2 import EC2Client else: EC2Client = object`.
affects: All versions when using `TYPE_CHECKING` guards.
Upgrade
Version history
1.43.83latest on PyPI · released Aug 28, 2026
Audit
Dependencies
boto3requiredRuntime dependency for which this package provides type stubs.
mypyoptionalPrimary static type checker for which these stubs are designed. Other type checkers like Pyright are also supported.
typing-extensionsoptionalMay be required for full type compatibility on Python versions older than 3.9.