Extend
Some digital employee core components can be extended, for example, identity, connectors (tools & MCPs), and the digital employee agent.
Extend Use Cases
Identity
Digital employee core can be extended using this code example:
from digital_employee_core import DigitalEmployeeIdentity
class ExtendedDigitalEmployeeIdentity(DigitalEmployeeIdentity):
"""Extended Digital Employee Identity with additional attributes."""
employee_id: strConnectors
Tools
We can add our own tools in addition to those already provided by GL Connectors by extending the BaseTool.
Here is the example:
Tool Input
from pydantic import BaseModel, Field
class GreetingInput(BaseModel):
user_name: str = Field(default="World", description="Name of the person to greet.")Tool Config
Tool Implementation
To configure the tools, we need to create a config_templates/tool_configs.yaml file. Here is an example of tool_configs.yaml :
To define default value for configs, create a config_templates/defaults.yaml file. Here is an example of defaults.yaml :
MCPs
Here is how we can create our own MCP:
We need to provide the config_templates/mcp_configs.yaml file to be able to use the MCP. Here is an example of mcp_configs.yaml:
Digital Employee Agent
To create a custom Digital Employee Agent with specialized behavior, you can extend both DigitalEmployeeAgent and its builder. Here's a complete example with multiple pipeline steps using the pipe operator (|):
1. Create Custom Components (Optional)
First, let's create custom components for preprocessing and postprocessing:
2. Extend the Agent Class
3. Create a Custom Builder
4. Instantiate the Extended Digital Employee
Now that we have created the custom agent and builder, let's instantiate the Digital Employee.
Import the Package
Initialize the Extended Digital Employee with Multiple Steps (Improved Approach)
This example demonstrates the improved approach where ALL steps can be combined using the pipe operator (|) by using build_step() from the agent builder:
Key Improvement:
By using build_step(identity, configs) on the agent builder, we can convert any StepBuilder to a ComponentStep. This enables using the pipe operator (|) for ALL steps in the pipeline:
✓ Works:
step1 | agent_step | step3(all steps combined with pipe)✓ Clean, readable pipeline definition
✓ Full flexibility in pipeline composition
Why This Works:
build_step(identity, configs)converts aStepBuilderto aComponentStepComponentStephas the__or__method implementedThe pipe operator combines
ComponentStepinstances into aPipelineThe
Pipelinecan be added toDigitalEmployeePipelineBuilderas a single step
Important Requirement:
To use build_step(), you need to create the identity first. This means:
Create
DigitalEmployeeIdentitywith all required fields (name, email, job)Call
build_step(identity=identity, configs=[])on your builderUse the resulting
ComponentStepwith the pipe operator
Working Example:
See examples/extend_example_with_pipe_operator_v2.py for a complete working example that demonstrates this approach.
In this example, we use new MCPs (via .add_mcps([new_google_mail_mcp])) and tools (via .add_tools([Tool.from_langchain(GreetingTool)])) that are specifically created for the extended digital employee.
We also use HELLO_GREETING_PREFIX, HELLO_GREETING_SUFFIX, NEW_GOOGLE_MAIL_MCP_URL and NEW_GOOGLE_MCP_X_API_KEY configs, which are defined in the config template of the new tool and MCP.
Run the Extended Digital Employee
Note: The new pattern uses async/await. Use employee.invoke(...) instead of the old employee.run(...) method.
Important: Before running the sample code, replace the following placeholders:
Replace
[gl-connectors-x-api-key]with x-api-key from GL Connectors. See below for one way to do it.(Optional) Replace
NEW_GOOGLE_MAIL_MCP_URLif you are using a different GL Connectors server instance.
🔑 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. Paste this value to replace
[gl-connectors-x-api-key].

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.

To see more examples, please check Digital Employee Example.
Last updated