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.invoke_agent()  # (2)
  1. client: AgentsforBedrockRuntimeClient
  2. result: InvokeAgentResponseTypeDef
# RetrievePaginator usage example

from boto3.session import Session


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

paginator = client.get_paginator("retrieve")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: AgentsforBedrockRuntimeClient
  2. paginator: RetrievePaginator
  3. item: RetrieveResponseTypeDef

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 InvokeAgentResponseTypeDef
from mypy_boto3_bedrock_agent_runtime.type_defs import InvokeAgentRequestRequestTypeDef


session = Session()

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

kwargs: InvokeAgentRequestRequestTypeDef = {...}
result: InvokeAgentResponseTypeDef = client.invoke_agent(**kwargs)
# RetrievePaginator 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 RetrievePaginator
from mypy_boto3_bedrock_agent_runtime.type_defs import RetrieveResponseTypeDef


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

paginator: RetrievePaginator = client.get_paginator("retrieve")
for item in paginator.paginate(...):
    item: RetrieveResponseTypeDef
    print(item)