Skip to content

Amazon Bedrock Agent Samples(startup-advisor-agent) - [Bug] Permission error when invoking Agents #161

@abhinavbom

Description

@abhinavbom

I am getting the following permission error when enovking the agents using the command mentioned:

.venvpcuser@Laptops-MacBook-Pro amazon-bedrock-agent-samples % python3 examples/multi_agent_collaboration/startup_advisor_agent/main.py \
--recreate_agents "false" \
--web_domain "flyingCars.com" \
--project "FlyingCars wants to be the leading supplier of flying cars. The project is to build an innovative marketing strategy to showcase FlyingCars' advancedofferings, emphasizing ease of use, cost effectiveness, productivity, and safety. Target high net worth individuals, highlighting success stories and transformative 
potential. Be sure to include a draft for a video ad."
boto3 version: 1.39.3


Creating marketing_strategy_agent as a supervisor agent...




Invoking supervisor agent...


time before call: 2025-07-10 16:09:11.474827

Here is the prompt being sent to the supervisor:

Please perform the following tasks sequentially. Be sure you do not 
perform any of them in parallel. If a task will require information produced from a prior task, 
be sure to include the details as input to the task.

Task 1. We are working on the following project: FlyingCars wants to be the leading supplier of flying cars. The project is to build an innovative marketing strategy to showcase FlyingCars' advancedofferings, emphasizing ease of use, cost effectiveness, productivity, and safety. Target high net worth individuals, highlighting success stories and transformative 
potential. Be sure to include a draft for a video ad.. Conduct research about the target customers and competitors  for the new product or service, while also taking into account the new web domain name  called: flyingCars.com. Make sure you perform thorough research to find interesting  and relevant information that will help produce the best possible marketing strategy. Since you are the first step in the project, you also use the agent store to  save the project description and web domain name.
 Expected output: A complete report on the target customer base and the competitors for the new  product or service. Provides clarity about the customer demographics, their preferences,  the market positioning versus the competition, and how the target audience gets engaged. Capture the entire resarch output as json in the agent store with key 'market_research'. Also the project details are saved as JSON in the agent store with key 'project_details'.

Task 2. Formulate a comprehensive marketing strategy for this project:  FlyingCars wants to be the leading supplier of flying cars. The project is to build an innovative marketing strategy to showcase FlyingCars' advancedofferings, emphasizing ease of use, cost effectiveness, productivity, and safety. Target high net worth individuals, highlighting success stories and transformative 
potential. Be sure to include a draft for a video ad., which will have the new web domain name called: flyingCars.com. You must be given as input the entire research results that the Analyst completed  for you (use the agent store for that). Use that research and add your own insights  to create a high-quality strategy.
 Expected output: A detailed marketing strategy document that outlines the goals, target  audience, key messages, and proposed tactics. Be sure to also identify  marketing channels, and key metrics. The strategy takes into account the  research from your analyst. You save the entire strategy as json  in the agent store with key 'marketing_strategy'.

Task 3. Develop creative marketing campaign ideas for this project: FlyingCars wants to be the leading supplier of flying cars. The project is to build an innovative marketing strategy to showcase FlyingCars' advancedofferings, emphasizing ease of use, cost effectiveness, productivity, and safety. Target high net worth individuals, highlighting success stories and transformative 
potential. Be sure to include a draft for a video ad.. You must be given as input the entire research results that the Strategist completed. Ensure your campaign ideas are innovative, engaging, and aligned with the   marketing strategy. Be sure that at least one of the ideas is an  online video ad campaign using a brief but powerful 6-second video.
 Expected output: A list of three campaign ideas, each with a brief description and  an explanation of the expected impact of the campaign. Sort them by descending order of  positive impact, with the most impactful campaign first. You MUST save the list of  campaign ideas as json in the agent store with key 'campaign_ideas'.

Task 4. Create high-level marketing copy for each campaign idea for the project: FlyingCars wants to be the leading supplier of flying cars. The project is to build an innovative marketing strategy to showcase FlyingCars' advancedofferings, emphasizing ease of use, cost effectiveness, productivity, and safety. Target high net worth individuals, highlighting success stories and transformative 
potential. Be sure to include a draft for a video ad.. You must be given as input the set of campaign ideas created earlier. Ensure each campaign copy is compelling, clear, and tailored to the target audience. 
 Expected output: For each marketing campaign, output includes: a compelling title, a one line summary,  and importantly adds a few paragraphs of copy. You MUST save the list (in the same order  you received the ideas) of campaign copies as json in the agent store with key 'campaign_copies'.

Task 5. Pick the first campaign idea from the set of ideas already created. This  is a campaign to help with this project: FlyingCars wants to be the leading supplier of flying cars. The project is to build an innovative marketing strategy to showcase FlyingCars' advancedofferings, emphasizing ease of use, cost effectiveness, productivity, and safety. Target high net worth individuals, highlighting success stories and transformative 
potential. Be sure to include a draft for a video ad.. For this one campaign idea, draft a detailed Campaign Report. Be as  thorough as possible.
 Expected output: A detailed campaign report covering only the highest impact campaign idea,  organized with ALL of the following MANDATORY report sections:  A/ CAMPAIGN DESCRIPTION - explain the concept, the audience, the channels, and the assets. B/ CAMPAIGN VALUE PROPOSITION - explain the product value propisition that is delivered to the audience. C/ CAMPAIGN CALL TO ACTION - explain what the audience is supposed to do in response to this campaign. D/ CAMPAIGN METRICS - explain how the effectiveness of the campaign will be measured. You MUST save the report as json in the agent store with key 'detailed_campaign_report_v1'.

Task 6. The strategist hands you the draft detailed copy for one campaign as input.  You then go through 1 iterations of feedback and revisions to improve the  campaign report and make it more complete.  For each iteration, you ask the Creative Director to provide feedback. The Director retrieves the latest version of the report AND MUST retrieve the  prior feedback if this is not the first iteration. Based on those inputs  (prior feedback, current report), the Director produces and MUST SAVE a new round of feedback  to the agent store. The Director NEVER forgets to SAVE the feedback to the agent store. The Writer retrieves the new feedback AND the prior version of the report, and creates and saves a new version of the report incorporating the feedback. The Writer NEVER forgets that it must retrieve not only the feedback, but ALSO the prior  version of the report. Without the prior version, the Writer will not be able to  incorporate the feedback into the report and will just start from scratch every time.  Do this until you have produced a final version of the report that incorporates  1 rounds of feedback. To avoid potential confusion, you  give each collaborator the names of the keys to use. Be sure to enforce all mandatory  report sections. The CEO gets upset if the report is incomplete.
 Expected output: The final detailed Campaign Report after having incorporated 1  separate rounds of feedback to extend and improve the initial version of the report. Be sure to mention the key name that was used when saving the final report in the agent store.

Task 7. The team of collaborators has done a great job! Now the humans running the actual project  need a polished final report they can use as an excellent starting point to help  our startup customer that is looking to go big with their new product. Give all the agent store  keys for the whole project (including the feedback keys) to the Formatted Report Writer, and have them produce a formatted  final report. The Formatted Report Writer is an expert at doing this. To be more efficient, break up the work into multiple tasks, and have the writer write the final report in  multiple parts that can be assembled offline. Since the sections are independent, feel free to write them  in parallel. Name these with a 'section_' prefix (e.g., 'section_executive_summary'). As a final step, ask the Formatted Report Writer  to retrieve a fresh copy of the markdown for each section from the agent store. With all the full text freshly retrieved, concatenate the sections in the correct order, and save the FULL and complete text (not just placeholders) to the agent store with  key 'complete_final_report'.
 Expected output: A formatted report saved in the agent store, the keys that its sections are stored in, and the complete final report key. The complete final report is the concatenation of the  FULL TEXT of all the sections in the correct order.


Before returning the final answer, review whether you have achieved the expected output for each task.

Use a single Working Memory table for this entire set of tasks, with 
table name: startup-advisor-8a88a555-4b37-48b4-b636-17c812a08e66. Tell your collaborators this table name as part of 
every request, so that they are not confused and they share state effectively.
The keys they use in that table will allow them to keep track of any number 
of state items they require. When you have completed all tasks, summarize 
your work, and share the table name so that all the results can be used and 
analyzed.

Session id: startup_advisor-1752188951-e3d378ca-5de2-11f0-bb64-d2ccc77b150a
invokeAgent API request ID: 06415601-6052-4777-9278-b3eae52847a3
invokeAgent API session ID: startup_advisor-1752188951-e3d378ca-5de2-11f0-bb64-d2ccc77b150a
  agent id: TZXZAAWSYJ, agent alias id: O3OT6P7JM8
Agent error: Access denied when calling Bedrock. Check your request permissions and retry the request.
Caught exception while processing input to invokeAgent:

  for input text:

Please perform the following tasks sequentially. Be sure you do not 
perform any of them in parallel. If a task will require information produced from a prior task, 
be sure to include the details as input to the task.

Task 1. We are working on the following project: FlyingCars wants to be the leading supplier of flying cars. The project is to build an innovative marketing strategy to showcase FlyingCars' advancedofferings, emphasizing ease of use, cost effectiveness, productivity, and safety. Target high net worth individuals, highlighting success stories and transformative 
potential. Be sure to include a draft for a video ad.. Conduct research about the target customers and competitors  for the new product or service, while also taking into account the new web domain name  called: flyingCars.com. Make sure you perform thorough research to find interesting  and relevant information that will help produce the best possible marketing strategy. Since you are the first step in the project, you also use the agent store to  save the project description and web domain name.
 Expected output: A complete report on the target customer base and the competitors for the new  product or service. Provides clarity about the customer demographics, their preferences,  the market positioning versus the competition, and how the target audience gets engaged. Capture the entire resarch output as json in the agent store with key 'market_research'. Also the project details are saved as JSON in the agent store with key 'project_details'.

Task 2. Formulate a comprehensive marketing strategy for this project:  FlyingCars wants to be the leading supplier of flying cars. The project is to build an innovative marketing strategy to showcase FlyingCars' advancedofferings, emphasizing ease of use, cost effectiveness, productivity, and safety. Target high net worth individuals, highlighting success stories and transformative 
potential. Be sure to include a draft for a video ad., which will have the new web domain name called: flyingCars.com. You must be given as input the entire research results that the Analyst completed  for you (use the agent store for that). Use that research and add your own insights  to create a high-quality strategy.
 Expected output: A detailed marketing strategy document that outlines the goals, target  audience, key messages, and proposed tactics. Be sure to also identify  marketing channels, and key metrics. The strategy takes into account the  research from your analyst. You save the entire strategy as json  in the agent store with key 'marketing_strategy'.

Task 3. Develop creative marketing campaign ideas for this project: FlyingCars wants to be the leading supplier of flying cars. The project is to build an innovative marketing strategy to showcase FlyingCars' advancedofferings, emphasizing ease of use, cost effectiveness, productivity, and safety. Target high net worth individuals, highlighting success stories and transformative 
potential. Be sure to include a draft for a video ad.. You must be given as input the entire research results that the Strategist completed. Ensure your campaign ideas are innovative, engaging, and aligned with the   marketing strategy. Be sure that at least one of the ideas is an  online video ad campaign using a brief but powerful 6-second video.
 Expected output: A list of three campaign ideas, each with a brief description and  an explanation of the expected impact of the campaign. Sort them by descending order of  positive impact, with the most impactful campaign first. You MUST save the list of  campaign ideas as json in the agent store with key 'campaign_ideas'.

Task 4. Create high-level marketing copy for each campaign idea for the project: FlyingCars wants to be the leading supplier of flying cars. The project is to build an innovative marketing strategy to showcase FlyingCars' advancedofferings, emphasizing ease of use, cost effectiveness, productivity, and safety. Target high net worth individuals, highlighting success stories and transformative 
potential. Be sure to include a draft for a video ad.. You must be given as input the set of campaign ideas created earlier. Ensure each campaign copy is compelling, clear, and tailored to the target audience. 
 Expected output: For each marketing campaign, output includes: a compelling title, a one line summary,  and importantly adds a few paragraphs of copy. You MUST save the list (in the same order  you received the ideas) of campaign copies as json in the agent store with key 'campaign_copies'.

Task 5. Pick the first campaign idea from the set of ideas already created. This  is a campaign to help with this project: FlyingCars wants to be the leading supplier of flying cars. The project is to build an innovative marketing strategy to showcase FlyingCars' advancedofferings, emphasizing ease of use, cost effectiveness, productivity, and safety. Target high net worth individuals, highlighting success stories and transformative 
potential. Be sure to include a draft for a video ad.. For this one campaign idea, draft a detailed Campaign Report. Be as  thorough as possible.
 Expected output: A detailed campaign report covering only the highest impact campaign idea,  organized with ALL of the following MANDATORY report sections:  A/ CAMPAIGN DESCRIPTION - explain the concept, the audience, the channels, and the assets. B/ CAMPAIGN VALUE PROPOSITION - explain the product value propisition that is delivered to the audience. C/ CAMPAIGN CALL TO ACTION - explain what the audience is supposed to do in response to this campaign. D/ CAMPAIGN METRICS - explain how the effectiveness of the campaign will be measured. You MUST save the report as json in the agent store with key 'detailed_campaign_report_v1'.

Task 6. The strategist hands you the draft detailed copy for one campaign as input.  You then go through 1 iterations of feedback and revisions to improve the  campaign report and make it more complete.  For each iteration, you ask the Creative Director to provide feedback. The Director retrieves the latest version of the report AND MUST retrieve the  prior feedback if this is not the first iteration. Based on those inputs  (prior feedback, current report), the Director produces and MUST SAVE a new round of feedback  to the agent store. The Director NEVER forgets to SAVE the feedback to the agent store. The Writer retrieves the new feedback AND the prior version of the report, and creates and saves a new version of the report incorporating the feedback. The Writer NEVER forgets that it must retrieve not only the feedback, but ALSO the prior  version of the report. Without the prior version, the Writer will not be able to  incorporate the feedback into the report and will just start from scratch every time.  Do this until you have produced a final version of the report that incorporates  1 rounds of feedback. To avoid potential confusion, you  give each collaborator the names of the keys to use. Be sure to enforce all mandatory  report sections. The CEO gets upset if the report is incomplete.
 Expected output: The final detailed Campaign Report after having incorporated 1  separate rounds of feedback to extend and improve the initial version of the report. Be sure to mention the key name that was used when saving the final report in the agent store.

Task 7. The team of collaborators has done a great job! Now the humans running the actual project  need a polished final report they can use as an excellent starting point to help  our startup customer that is looking to go big with their new product. Give all the agent store  keys for the whole project (including the feedback keys) to the Formatted Report Writer, and have them produce a formatted  final report. The Formatted Report Writer is an expert at doing this. To be more efficient, break up the work into multiple tasks, and have the writer write the final report in  multiple parts that can be assembled offline. Since the sections are independent, feel free to write them  in parallel. Name these with a 'section_' prefix (e.g., 'section_executive_summary'). As a final step, ask the Formatted Report Writer  to retrieve a fresh copy of the markdown for each section from the agent store. With all the full text freshly retrieved, concatenate the sections in the correct order, and save the FULL and complete text (not just placeholders) to the agent store with  key 'complete_final_report'.
 Expected output: A formatted report saved in the agent store, the keys that its sections are stored in, and the complete final report key. The complete final report is the concatenation of the  FULL TEXT of all the sections in the correct order.


Before returning the final answer, review whether you have achieved the expected output for each task.

Use a single Working Memory table for this entire set of tasks, with 
table name: startup-advisor-8a88a555-4b37-48b4-b636-17c812a08e66. Tell your collaborators this table name as part of 
every request, so that they are not confused and they share state effectively.
The keys they use in that table will allow them to keep track of any number 
of state items they require. When you have completed all tasks, summarize 
your work, and share the table name so that all the results can be used and 
analyzed.

  on agent: TZXZAAWSYJ, alias: O3OT6P7JM8
  request ID: 06415601-6052-4777-9278-b3eae52847a3, retries: 0

Error: An error occurred (accessDeniedException) when calling the InvokeAgent operation: Access denied when calling Bedrock. Check your request permissions and retry the request.
('Unexpected exception: ', EventStreamError('An error occurred (accessDeniedException) when calling the InvokeAgent operation: Access denied when calling Bedrock. Check your request permissions and retry the request.'))
Traceback (most recent call last):
  File "/Users/pcuser/Desktop/amazon-bedrock-agent-samples/src/utils/bedrock_agent_helper.py", line 2079, in invoke
    for _event in _event_stream:
                  ^^^^^^^^^^^^^
  File "/Users/pcuser/Desktop/amazon-bedrock-agent-samples/.venv/lib/python3.13/site-packages/botocore/eventstream.py", line 592, in __iter__
    parsed_event = self._parse_event(event)
  File "/Users/pcuser/Desktop/amazon-bedrock-agent-samples/.venv/lib/python3.13/site-packages/botocore/eventstream.py", line 608, in _parse_event
    raise EventStreamError(parsed_response, self._operation_name)
botocore.exceptions.EventStreamError: An error occurred (accessDeniedException) when calling the InvokeAgent operation: Access denied when calling Bedrock. Check your request permissions and retry the request.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/pcuser/Desktop/amazon-bedrock-agent-samples/examples/multi_agent_collaboration/startup_advisor_agent/main.py", line 157, in main
    result = startup_advisor.invoke_with_tasks([
                    research_task, marketing_strategy_task,
    ...<13 lines>...
                enable_trace=True, trace_level=args.trace_level,
                verbose=True)
  File "/Users/pcuser/Desktop/amazon-bedrock-agent-samples/src/utils/bedrock_agent.py", line 1155, in invoke_with_tasks
    result = self.invoke(
        input_text=dedent(prompt),
    ...<3 lines>...
        multi_agent_names=self.multi_agent_names,
    )
  File "/Users/pcuser/Desktop/amazon-bedrock-agent-samples/src/utils/bedrock_agent.py", line 1093, in invoke
    return agents_helper.invoke(
           ~~~~~~~~~~~~~~~~~~~~^
        input_text,
        ^^^^^^^^^^^
    ...<6 lines>...
        multi_agent_names=multi_agent_names,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/Users/pcuser/Desktop/amazon-bedrock-agent-samples/src/utils/bedrock_agent_helper.py", line 2597, in invoke
    raise Exception("Unexpected exception: ", e)
Exception: ('Unexpected exception: ', EventStreamError('An error occurred (accessDeniedException) when calling the InvokeAgent operation: Access denied when calling Bedrock. Check your request permissions and retry the request.'))

Time taken: 0.9 seconds

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions