Skip to content

Examples#

Index > AgentsforBedrockRuntime > Examples

Auto-generated documentation for AgentsforBedrockRuntime type annotations stubs module mypy-boto3-bedrock-agent-runtime.

Client#

Implicit type annotations#

Can be used with boto3-stubs[bedrock-agent-runtime] package installed.

Write your AgentsforBedrockRuntime code as usual, type checking and code completion should work out of the box.

# AgentsforBedrockRuntimeClient usage example

from boto3.session import Session


session = Session()

client = session.client("bedrock-agent-runtime")  # (1)
result = client.generate_query()  # (2)
  1. client: AgentsforBedrockRuntimeClient
  2. result: GenerateQueryResponseTypeDef
# GetAgentMemoryPaginator usage example

from boto3.session import Session


session = Session()
client = session.client("bedrock-agent-runtime")  # (1)

paginator = client.get_paginator("get_agent_memory")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: AgentsforBedrockRuntimeClient
  2. paginator: GetAgentMemoryPaginator
  3. item: GetAgentMemoryResponseTypeDef

Explicit type annotations#

With boto3-stubs-lite[bedrock-agent-runtime] or a standalone mypy_boto3_bedrock_agent_runtime package, you have to explicitly specify client: AgentsforBedrockRuntimeClient type annotation.

All other type annotations are optional, as types should be discovered automatically. However, these type annotations can be helpful in your functions and methods.

# AgentsforBedrockRuntimeClient usage example with type annotations

from boto3.session import Session

from mypy_boto3_bedrock_agent_runtime.client import AgentsforBedrockRuntimeClient
from mypy_boto3_bedrock_agent_runtime.type_defs import GenerateQueryResponseTypeDef
from mypy_boto3_bedrock_agent_runtime.type_defs import GenerateQueryRequestRequestTypeDef


session = Session()

client: AgentsforBedrockRuntimeClient = session.client("bedrock-agent-runtime")

kwargs: GenerateQueryRequestRequestTypeDef = {...}
result: GenerateQueryResponseTypeDef = client.generate_query(**kwargs)
# GetAgentMemoryPaginator usage example with type annotations

from boto3.session import Session

from mypy_boto3_bedrock_agent_runtime.client import AgentsforBedrockRuntimeClient
from mypy_boto3_bedrock_agent_runtime.paginator import GetAgentMemoryPaginator
from mypy_boto3_bedrock_agent_runtime.type_defs import GetAgentMemoryResponseTypeDef


session = Session()
client: AgentsforBedrockRuntimeClient = session.client("bedrock-agent-runtime")

paginator: GetAgentMemoryPaginator = client.get_paginator("get_agent_memory")
for item in paginator.paginate(...):
    item: GetAgentMemoryResponseTypeDef
    print(item)