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:
Install the
digital-employee-corepackageSet the required environment variables in your terminal or in a
.envfile
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
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 executionDigitalEmployeeAgentBuilder: 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
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 executionGOOGLE_MAIL_MCP_URL- Google Mail MCP server URLGOOGLE_MCP_X_API_KEY- Your x-api-key for GL Connectors authenticationEMAIL_RECIPIENT- The email address where the welcome email will be sent
🔑 Get GL Connectors x-api-key
Open https://connectors.gdplabs.id/console, then sign in.
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_KEYenvironment variable.If your Gmail account has not been integrated yet, continue with the steps below.
Under Available Modules section, find the Google_mail integration and click Add New Integration button.
An authorization URL will appear. Click or copy the URL, then authenticate using your Gmail account.
Below is an example of a successfully integrated Gmail account.
Summary
Use
DigitalEmployeeAgentBuilderto create agent steps with MCPs and LLMsConfigure MCPs using
add_mcps()and load configuration from environment variablesThe 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