Skip to content

Examples#

Index > AgentsforBedrock > Examples

Auto-generated documentation for AgentsforBedrock type annotations stubs module types-aiobotocore-bedrock-agent.

Client#

Implicit type annotations#

Can be used with types-aioboto3[bedrock-agent] package installed.

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

# AgentsforBedrockClient usage example

from aioboto3.session import Session


session = Session()

async with session.client("bedrock-agent") as client:  # (1)
    result = await client.associate_agent_knowledge_base()  # (2)
  1. client: AgentsforBedrockClient
  2. result: AssociateAgentKnowledgeBaseResponseTypeDef
# ListAgentActionGroupsPaginator usage example

from aioboto3.session import Session


session = Session()

async with session.client("bedrock-agent") as client:  # (1)
    paginator = client.get_paginator("list_agent_action_groups")  # (2)
    async for item in paginator.paginate(...):
        print(item)  # (3)
  1. client: AgentsforBedrockClient
  2. paginator: ListAgentActionGroupsPaginator
  3. item: ListAgentActionGroupsResponseTypeDef

Explicit type annotations#

With types-aioboto3-lite[bedrock-agent] or a standalone types_aiobotocore_bedrock_agent package, you have to explicitly specify client: AgentsforBedrockClient 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.

# AgentsforBedrockClient usage example with type annotations

from aioboto3.session import Session

from types_aiobotocore_bedrock_agent.client import AgentsforBedrockClient
from types_aiobotocore_bedrock_agent.type_defs import AssociateAgentKnowledgeBaseResponseTypeDef
from types_aiobotocore_bedrock_agent.type_defs import AssociateAgentKnowledgeBaseRequestRequestTypeDef


session = Session()

client: AgentsforBedrockClient
async with session.client("bedrock-agent") as client:  # (1)
    kwargs: AssociateAgentKnowledgeBaseRequestRequestTypeDef = {...}  # (2)
    result: AssociateAgentKnowledgeBaseResponseTypeDef = await client.associate_agent_knowledge_base(**kwargs)  # (3)
  1. client: AgentsforBedrockClient
  2. kwargs: AssociateAgentKnowledgeBaseRequestRequestTypeDef
  3. result: AssociateAgentKnowledgeBaseResponseTypeDef
# ListAgentActionGroupsPaginator usage example with type annotations

from aioboto3.session import Session

from types_aiobotocore_bedrock_agent.client import AgentsforBedrockClient
from types_aiobotocore_bedrock_agent.paginator import ListAgentActionGroupsPaginator
from types_aiobotocore_bedrock_agent.type_defs import ListAgentActionGroupsResponseTypeDef


session = Session()

client: AgentsforBedrockClient
async with session.client("bedrock-agent") as client:  # (1)
    paginator: ListAgentActionGroupsPaginator = client.get_paginator("list_agent_action_groups")  # (2)
    async for item in paginator.paginate(...):
        item: ListAgentActionGroupsResponseTypeDef
        print(item)  # (3)
  1. client: AgentsforBedrockClient
  2. paginator: ListAgentActionGroupsPaginator
  3. item: ListAgentActionGroupsResponseTypeDef