bedrock_agents_sdk.models package
Submodules
bedrock_agents_sdk.models.action_group module
ActionGroup model for Bedrock Agents SDK.
- class bedrock_agents_sdk.models.action_group.ActionGroup(*, name: str, description: str, functions: List[Function | Callable] = [])[source]
Bases:
BaseModel
Represents an action group in the agent
- description: str
- model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- name: str
bedrock_agents_sdk.models.agent module
Agent model for Bedrock Agents SDK.
- class bedrock_agents_sdk.models.agent.Agent(**data)[source]
Bases:
object
Agent configuration for Amazon Bedrock Agents
- action_groups: List[ActionGroup]
- add_action_group(action_group: ActionGroup)[source]
Add an action group to the agent
- Parameters:
action_group – The action group to add
- Returns:
For method chaining
- Return type:
self
- add_dependency(dependency: str, version: str | None = None, action_group: str | None = None)[source]
Add a custom dependency for deployment
This method allows you to specify dependencies that should be included in the requirements.txt file when deploying the agent to AWS Lambda.
- Parameters:
dependency – The name of the dependency (e.g., “pandas”)
version – Optional version constraint (e.g., “>=1.0.0”)
action_group – Optional action group to add the dependency to. If not provided, the dependency will be added to all action groups.
- Returns:
For method chaining
- Return type:
self
- add_file(name: str, content: bytes, media_type: str, use_case: str = 'CODE_INTERPRETER') InputFile [source]
Add a file to be sent to the agent
- add_file_from_path(file_path: str, use_case: str = 'CODE_INTERPRETER') InputFile [source]
Add a file from a local path
- add_function(function: Callable, description: str | None = None, action_group: str | None = None)[source]
Add a function to the agent
- add_plugin(plugin: AgentPlugin)[source]
Add a plugin to the agent
- Parameters:
plugin – The plugin to add
- advanced_config: Dict[str, Any] | None = None
- deploy(output_dir: str | None = None, foundation_model: str | None = None, parameters: Dict[str, Dict[str, str]] | None = None, description: str | None = None, auto_build: bool = False, auto_deploy: bool = False) str [source]
Deploy the agent to AWS using SAM
- Parameters:
output_dir – The directory to output the SAM template and code to. If None, defaults to “./[agent_name]_deployment”
foundation_model – The foundation model to use (defaults to the agent’s model)
parameters – Additional parameters to add to the template
description – Description for the SAM template
auto_build – Whether to automatically run ‘sam build’
auto_deploy – Whether to automatically run ‘sam deploy –guided’
- Returns:
Path to the generated template file
- Return type:
str
- enable_code_interpreter: bool = False
- functions: List[Callable] | Dict[str, List[Callable]]
- instructions: str
- model: str
- model_config = {'arbitrary_types_allowed': True}
- name: str
- plugins: List[AgentPlugin]
bedrock_agents_sdk.models.files module
File models for Bedrock Agents SDK.
- class bedrock_agents_sdk.models.files.InputFile(*, name: str, content: bytes, media_type: str, use_case: str = 'CODE_INTERPRETER')[source]
Bases:
BaseModel
Represents a file to be sent to the agent
- content: bytes
- media_type: str
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- name: str
- use_case: str
- class bedrock_agents_sdk.models.files.OutputFile(name: str, content: bytes, file_type: str)[source]
Bases:
object
Represents a file received from the agent
- classmethod from_response(file_data: Dict[str, Any]) OutputFile [source]
Create an OutputFile from API response data
bedrock_agents_sdk.models.function module
Function model for Bedrock Agents SDK.
- class bedrock_agents_sdk.models.function.Function(*, name: str, description: str, function: Callable, action_group: str | None = None)[source]
Bases:
BaseModel
Represents a function that can be called by the agent
- action_group: str | None
- description: str
- function: Callable
- model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- name: str
bedrock_agents_sdk.models.message module
Message model for Bedrock Agents SDK.
- class bedrock_agents_sdk.models.message.Message(*, role: str, content: str)[source]
Bases:
BaseModel
Represents a message in the conversation
- content: str
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- role: str