Pipeline With Agent

This quickstart guide walks you through a simple setup to create a digital employee with an agent — using DigitalEmployeeAgentBuilder, MCPs, and an LLM to interact with external services (e.g., Gmail).

Prerequisites

To follow this example, you will need to:

  • Installarrow-up-right the digital-employee-core package

  • Set the required environment variables in your terminal or in a .env file

circle-info

Required environment variables:

export OPENAI_API_KEY=<OPENAI_API_KEY>

# For Google Mail MCP integration
export GOOGLE_MAIL_MCP_URL=https://connectors.gdplabs.id/google_mail/mcp
export GOOGLE_MCP_X_API_KEY=<your-x-api-key>

# Email recipient for the example
export EMAIL_RECIPIENT=<your-email@example.com>

You can also create a .env file in your project root with these variables.

Build Digital Employee - A Basic Example

Start by creating a simple digital employee that can interact with Gmail. This agent will use OpenAI GPT-5.1 as its language model, an MCP setup, and a simple prompt to guide its behavior.

Import the Package

Initialize the Digital Employee

circle-info

The builder pattern provides a fluent interface for configuring your digital employee:

  • DigitalEmployeeBuilder: Configures the digital employee's identity (name, email, job)

  • DigitalEmployeePipelineBuilder: Creates the pipeline that orchestrates execution

  • DigitalEmployeeAgentBuilder: Configures agent steps with MCPs and configurations

Use add_configs_from_env() to automatically load configuration values from environment variables instead of hardcoding them.

Invoke the Digital Employee Pipeline

circle-info

Environment Variables Setup:

Make sure you have set all the required environment variables before running the example:

  • OPENAI_API_KEY - Your OpenAI API key for local execution

  • GOOGLE_MAIL_MCP_URL - Google Mail MCP server URL

  • GOOGLE_MCP_X_API_KEY - Your x-api-key for GL Connectors authentication

  • EMAIL_RECIPIENT - The email address where the welcome email will be sent

chevron-right🔑 Get GL Connectors x-api-keyhashtag
  1. In the Credentials section, expand the x-api-key panel and click Copy combined value button. Use this value for the GOOGLE_MCP_X_API_KEY environment variable.

  2. If your Gmail account has not been integrated yet, continue with the steps below.

  3. Under Available Modules section, find the Google_mail integration and click Add New Integration button.

  4. An authorization URL will appear. Click or copy the URL, then authenticate using your Gmail account.

  5. Below is an example of a successfully integrated Gmail account.

Summary

  • Use DigitalEmployeeAgentBuilder to create agent steps with MCPs and LLMs

  • Configure MCPs using add_mcps() and load configuration from environment variables

  • The pipeline can interact with external services like Gmail through MCPs

  • For simpler pipelines without agents, see Pipeline Without Agent

Next Steps

Now that you've built a basic digital employee with an agent, explore the Guides for more advanced configurations and examples.

Last updated