Create an agent

In Gemini Enterprise, agents are created within the context of an app. You can create a new agent in two primary ways:

  • Create an agent using a prompt: This is the quickest way to create an agent. You describe the agent's purpose, and Agent Designer generates the initial version for you within your app. This is ideal for basic agents or as a starting point for more complex ones.
  • Create an agent using the flow builder: This method gives you direct, granular control over the agent's design from the beginning. It's ideal for designing complex, multi-step agents that require specific subagent configurations and logic flows.

These methods are flexible, and you can combine them to suit your requirements. For example, you can start with a prompt to generate the initial agent and then switch to the flow builder to visually refine its logic and add complexity.

Best practices for creating agents

To ensure your agents perform effectively and efficiently, consider the following best practices:

  • Define clear objectives: clearly state what you want your agent to achieve. A well-defined objective helps in designing the agent's logic and evaluating its performance.
  • Start small, then expand: begin with a basic agent that handles core functionalities. Once it's stable, gradually add more features and complexity.
  • Break down complex tasks: for multi-step agents, divide large tasks into smaller, manageable sub-tasks. Each subagent should have a specific role.
  • Test iteratively: regularly test your agent at each stage of development. This helps identify and fix issues early.
  • Provide clear instructions: when using prompts, be specific and concise. Avoid ambiguity to ensure the agent understands its purpose. See Best practices for writing prompts to create an agent.

Before you begin

Ensure you have an app with the necessary data sources connected. For more information, see Create an app, Connect a Google data source, and Connect a third-party data source.

Create an agent using a prompt

Use this method to quickly generate an agent using conversational input.

Console

To create an agent using a natural language prompt, do the following:

  1. In the Google Cloud console, go to the Gemini Enterprise > Apps page.

    Gemini Enterprise

  2. Select your app and copy the Gemini Enterprise web app URL from the Dashboard.

  3. Open the web app URL in a new browser tab.

  4. In the web app navigation menu, click + Create agent.

    The Agent Designer page appears.

  5. In the chat box, enter a prompt that describes your agent's purpose and intended behavior.

  6. Optional: Click Agents
icon Manage your data and enable or disable the data sources you want your agent to use.

  7. Click Submit.

    The Agent Designer canvas appears, displaying a live preview of your agent.

  8. In the Preview tab, interact with your agent to test and evaluate its responses.

  9. Click the Details tab and review your agent's name and description.

    • Optional: In the Knowledge section, click Add files to upload any additional reference materials for your agent.
    • Optional: In the Personalization section, add starter prompts that guide users on how to interact with the agent. You can add as many starter prompts as you like, but the system shows you a random selection of up to three prompts at a time.
  10. Optional: Refine your agent's function and behaviour by providing additional instructions in the left chat pane.

  11. Click Create to launch and start using your agent.

Best practices for writing prompts to create an agent

The prompt you provide helps Gemini understand your goals and generate the best possible agent. To get clear and relevant responses, follow these guidelines and best practices:

  • Provide enough context to eliminate ambiguity

    Be specific about what you want the agent to do. For example, specify the level of detail, the types of examples to use, or the required output. This helps Gemini Enterprise to generate an agent plan that is more relevant and specific to your needs.

    Not recommended: Create an agent for sales emails.

    Recommended: Create an agent that drafts follow-up emails for new sales leads from my CRM. It should search for the contact's company, summarize their business, and suggest how our product can help them.

  • Set boundaries or limitations on the agent's output

    Define what the agent should and shouldn't do. You can set limits on the length of its responses, the format, the tone, or specific elements to include or exclude. This helps the agent stay focused and produce more predictable results.

    Not recommended: Create a sales email agent.

    Recommended: Create an agent that drafts follow-up emails for sales leads. The drafts should always use a professional tone, be no more than three paragraphs, and never include personal information about the client.

  • Prompt Gemini to ask you questions

    Instruct Gemini to ask you questions, if needed. This allows Gemini to gather details that it might have missed, and ensures that the resulting agent plan meets your expectations.

    Not recommended: Create an agent to handle sales emails.

    Recommended: I need an agent that can help me draft sales emails. First, ask me what information you need to effectively qualify a lead and draft a personalized message.

Examples of effective prompts

  • Simple example: Create a sales email agent that drafts concise follow-up emails to new leads. The tone should be professional, and the email should be no more than three paragraphs.

  • Advanced example: Create an agent that automatically drafts sales emails to leads. Use my Gmail and access emails with the 'leads' label. First, ask me to confirm which leads you should prioritize and what the main selling points are for each. Once you have this information, your drafts should be no more than three paragraphs and use a professional tone. Don't include any technical jargon or slang and never include any personal information about the client.

Create an agent using the flow builder

Use this method for granular control over agent design, model selection, and multi-step orchestration.

Console

To create an agent using the flow builder, do the following:

  1. Open your Gemini Enterprise web app in a browser.
  2. In the web app navigation menu, click + Create agent.

    The Agent Designer page appears.

  3. Click Proceed to builder to directly open the visual flow builder.

  4. In the Flow tab, add and configure the main agent node:

    1. Name: enter a name for your main agent.
    2. Model: select the Gemini LLM model for the main agent to use.
    3. Description: enter a summary of the main agent's purpose.
    4. Instructions: provide a detailed set of instructions that define the agent's objectives, tasks, and behaviors.
    5. Data and tools: click Add data sources & tools to add the data sources connected to your app.
  5. Build your subagent flow:

    1. In the Flow tab, hold the pointer over the main agent node, and then click Add subagent.
    2. Configure the subagent details.
  6. Repeat step 5 as needed to complete your subagent flow logic.

  7. Click the Details tab and review your agent's name and description.

    • Optional: In the Knowledge section, click Add files to upload any additional reference materials for your agent.
    • Optional: In the Personalization section, add starter prompts that guide users on how to interact with the agent. You can add as many starter prompts as you like, but the system shows you a random selection of up to three prompts at a time.
  8. Click the Preview tab to interact with your agent to test and evaluate if your agent flow logic is performing as expected.

  9. Click Create to launch and start using your agent.

What's next