-
Notifications
You must be signed in to change notification settings - Fork 9.5k
Creatiion of Bedrock Agent - Multi agent collaborators fails when multiple collaborators are added #42256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Community GuidelinesThis comment is added to every new Issue to provide quick reference to how the Terraform AWS Provider is maintained. Please review the information below, and thank you for contributing to the community that keeps the provider thriving! 🚀 Voting for Prioritization
Volunteering to Work on This Issue
|
Hey @preak95 👋 Thank you for taking the time to raise this! This does seem like something that should be addressed, so I'm going to leave it open for prioritization. That said, I think I've figured out a workaround for you in the meantime. Notably, you providing an applyable sample configuration was extremely helpful, so thank you very much for doing that. While I wasn't actually able to reproduce the issue (presumably, this configuration is simplified enough that the preparation happens fairly quickly), I think a slight modification of the configuration should help. There's a wait function that's used by the resource "aws_bedrockagent_agent_collaborator" "example_2" {
agent_id = aws_bedrockagent_agent_collaborator.example_1.agent_id
collaboration_instruction = "tell the other agent what to do"
collaborator_name = "my-collab-example_2"
relay_conversation_history = "TO_COLLABORATOR"
agent_descriptor {
alias_arn = aws_bedrockagent_agent_alias.example_2.agent_alias_arn
}
} By interpolating the Before: flowchart TD
subgraph Terraform
data_aws_caller_identity_current["data.aws_caller_identity.current"]
data_aws_iam_policy_document_example_agent_permissions["data.aws_iam_policy_document.example_agent_permissions"]
data_aws_iam_policy_document_example_agent_trust["data.aws_iam_policy_document.example_agent_trust"]
data_aws_partition_current["data.aws_partition.current"]
data_aws_region_current["data.aws_region.current"]
aws_bedrockagent_agent_example_collaborator_1["aws_bedrockagent_agent.example_collaborator_1"]
aws_bedrockagent_agent_example_collaborator_2["aws_bedrockagent_agent.example_collaborator_2"]
aws_bedrockagent_agent_example_supervisor["aws_bedrockagent_agent.example_supervisor"]
aws_bedrockagent_agent_alias_example_1["aws_bedrockagent_agent_alias.example_1"]
aws_bedrockagent_agent_alias_example_2["aws_bedrockagent_agent_alias.example_2"]
aws_bedrockagent_agent_collaborator_example_1["aws_bedrockagent_agent_collaborator.example_1"]
aws_bedrockagent_agent_collaborator_example_2["aws_bedrockagent_agent_collaborator.example_2"]
aws_iam_role_example["aws_iam_role.example"]
aws_iam_role_policy_example["aws_iam_role_policy.example"]
end
data_aws_iam_policy_document_example_agent_permissions --> data_aws_caller_identity_current
data_aws_iam_policy_document_example_agent_permissions --> data_aws_partition_current
data_aws_iam_policy_document_example_agent_permissions --> data_aws_region_current
data_aws_iam_policy_document_example_agent_trust --> data_aws_caller_identity_current
data_aws_iam_policy_document_example_agent_trust --> data_aws_partition_current
data_aws_iam_policy_document_example_agent_trust --> data_aws_region_current
aws_bedrockagent_agent_example_collaborator_1 --> aws_iam_role_example
aws_bedrockagent_agent_example_collaborator_2 --> aws_iam_role_example
aws_bedrockagent_agent_example_supervisor --> aws_iam_role_example
aws_bedrockagent_agent_alias_example_1 --> aws_bedrockagent_agent_example_collaborator_1
aws_bedrockagent_agent_alias_example_2 --> aws_bedrockagent_agent_example_collaborator_2
aws_bedrockagent_agent_collaborator_example_1 --> aws_bedrockagent_agent_example_supervisor
aws_bedrockagent_agent_collaborator_example_1 --> aws_bedrockagent_agent_alias_example_1
aws_bedrockagent_agent_collaborator_example_2 --> aws_bedrockagent_agent_example_supervisor
aws_bedrockagent_agent_collaborator_example_2 --> aws_bedrockagent_agent_alias_example_2
aws_iam_role_example --> data_aws_iam_policy_document_example_agent_trust
aws_iam_role_policy_example --> data_aws_iam_policy_document_example_agent_permissions
aws_iam_role_policy_example --> aws_iam_role_example
After: flowchart TD
subgraph Terraform
data_aws_caller_identity_current["data.aws_caller_identity.current"]
data_aws_iam_policy_document_example_agent_permissions["data.aws_iam_policy_document.example_agent_permissions"]
data_aws_iam_policy_document_example_agent_trust["data.aws_iam_policy_document.example_agent_trust"]
data_aws_partition_current["data.aws_partition.current"]
data_aws_region_current["data.aws_region.current"]
aws_bedrockagent_agent_example_collaborator_1["aws_bedrockagent_agent.example_collaborator_1"]
aws_bedrockagent_agent_example_collaborator_2["aws_bedrockagent_agent.example_collaborator_2"]
aws_bedrockagent_agent_example_supervisor["aws_bedrockagent_agent.example_supervisor"]
aws_bedrockagent_agent_alias_example_1["aws_bedrockagent_agent_alias.example_1"]
aws_bedrockagent_agent_alias_example_2["aws_bedrockagent_agent_alias.example_2"]
aws_bedrockagent_agent_collaborator_example_1["aws_bedrockagent_agent_collaborator.example_1"]
aws_bedrockagent_agent_collaborator_example_2["aws_bedrockagent_agent_collaborator.example_2"]
aws_iam_role_example["aws_iam_role.example"]
aws_iam_role_policy_example["aws_iam_role_policy.example"]
end
data_aws_iam_policy_document_example_agent_permissions --> data_aws_caller_identity_current
data_aws_iam_policy_document_example_agent_permissions --> data_aws_partition_current
data_aws_iam_policy_document_example_agent_permissions --> data_aws_region_current
data_aws_iam_policy_document_example_agent_trust --> data_aws_caller_identity_current
data_aws_iam_policy_document_example_agent_trust --> data_aws_partition_current
data_aws_iam_policy_document_example_agent_trust --> data_aws_region_current
aws_bedrockagent_agent_example_collaborator_1 --> aws_iam_role_example
aws_bedrockagent_agent_example_collaborator_2 --> aws_iam_role_example
aws_bedrockagent_agent_example_supervisor --> aws_iam_role_example
aws_bedrockagent_agent_alias_example_1 --> aws_bedrockagent_agent_example_collaborator_1
aws_bedrockagent_agent_alias_example_2 --> aws_bedrockagent_agent_example_collaborator_2
aws_bedrockagent_agent_collaborator_example_1 --> aws_bedrockagent_agent_example_supervisor
aws_bedrockagent_agent_collaborator_example_1 --> aws_bedrockagent_agent_alias_example_1
aws_bedrockagent_agent_collaborator_example_2 --> aws_bedrockagent_agent_alias_example_2
aws_bedrockagent_agent_collaborator_example_2 --> aws_bedrockagent_agent_collaborator_example_1
aws_iam_role_example --> data_aws_iam_policy_document_example_agent_trust
aws_iam_role_policy_example --> data_aws_iam_policy_document_example_agent_permissions
aws_iam_role_policy_example --> aws_iam_role_example
|
Hello @justinretzolk Thanks for the thorough investigation and the workaround. I will try and check if this can somehow be extended when using |
@preak95 Were you able to use the workaround with |
@justinretzolk The similar issue is observed for action group as well when declaring an |
Terraform and AWS Provider Version
Affected Resource(s) or Data Source(s)
bedrockagent_agent_collaborator
bedrockagent_agent
Expected Behavior
When associating multiple agent collaborators with a Bedrock Agent SUPERVISOR, there should be a mechanism to wait for the agent to go into a
PREPARED
state before attempting to associate another agent collaborator.Actual Behavior
When associating a
collaborator
with a Bedrock Supervisor Agent, the agent goes into a preparing state. If multiple collaborators are associated with the agent at the same time, this causes the deployment to fail because the agent could still be in aPREPARING
state.When using
for_each
to deploy multiple such collaborators, this causes a failure. Upon, retryingapply
, terraform isn't aware of the dangling collaborators.Relevant Error/Panic Output
Sample Terraform Configuration
Click to expand configuration
Steps to Reproduce
Debug Logging
Click to expand log output
GenAI / LLM Assisted Development
n/a
Important Facts and References
Workaround:
When adding multiple collaborators, add one as a dependency for another. Doable for a few collaborators but not for multiple and hinders with module creation.
If this is expected behavior, would be great to have an example with multiple collaborators.
Would you like to implement a fix?
No
The text was updated successfully, but these errors were encountered: