I am not able to use the mega-agent with the webdemo integration.
Let me describe the process that I have used to create the agents.
- Created a mega agent in Dialogflow console. and the project is automatically created with the agent.
- Created a sub-agent and added this to the mega agent.
- Enabled the webdemo integration in the mega agent. tried to send a message to the mega agent. got this error -

- I figured that I have to add the service account for the mega agent to the service account of all the sub-agents to make this work. checked for the service account and found none below the project id.

- I went to google cloud console and created the service account and gave Dialogflow API admin permission.

(As you can see the dialogflow API admin role is not showing anywhere)
- Then I took this email for the mega agent service account and added it to the sub-agent service account (which I created) and tried to give a Dialogflow API client permission. but the permission is not available.

Now if I cant add this email with the Dialogflow permission I can't access the sub-agent from a mega agent and I cant make any progress with the mega agent integration.
How do I integrate the Mega agent with the Sub-Agents ?
Edit:
I was looking at the service accounts sections. but the automatically created accounts are located on the main page on IAM.
I have followed this documentation to create a mega agent and I am able to integrate the mega agent with my sub-agents using Dialogflow Web Demo.
You can refer to the below steps :
- Create a mega agent and add sub-agents to your mega agent.
- The sub-agents will be in different projects as in Dialogflow Essentials you can create only one agent per project.
- For integrating your mega agent with Dialogflow Web Demo you need to add the service account of the mega agent to your respective sub-agents.
- Dialogflow provides an automatically created service account of type “service-project-number@gcp-sa-dialogflow.iam.gserviceaccount.com”.
- When doing integrations you need to select the above automatically generated service account as per this document.
- This service account for mega agent's project needs to be a member of all sub-agent projects, and the applied role should have permission to make detect intent calls.
- The various roles that will provide access are : Project Owner, Project Editor, Dialogflow API Admin, or Dialogflow API Client.
You can also refer to the below screenshots :
1. Mega Agent

2. Service account in mega agent which needs to be added as a member in sub-agent’s project with defined roles. I have used the Dialogflow API Client role:

3. Intent and training phrases in sub-agent:

4. Integration of mega agent with sub-agent in Dialogflow Web Demo :
