Send emails and collect responses via email threads
Configuration
The Email contact channel allows agents to send emails and collect responses through email threads.
Configure an email channel using the EmailContactChannel
model:
Email Address
The address
field must be a valid email address that will receive the messages.
Context
The optional context_about_user
field helps the LLM understand who it’s emailing:
Usage
Use the email channel with either require_approval
or human_as_tool
features:
Or you can pass the contact_channel
to the HumanLayer
instance:
If you pass a channel to the HumanLayer
instance, you don’t need to pass it to the require_approval
or human_as_tool
features.
If you pass it to both, the channel in the require_approval
or human_as_tool
will take precedence.
Advanced - Collecting Agent Emails in a single thread
By default, every human contact or function call with trigger a new standalone email thread.
However, if you’re building agents that are kicked off by email runs, you likely want the email responses to be collected in a single thread.
You can do this by using the experimental_in_reply_to_message_id
and experimental_references_message_id
parameters
to the EmailContactChannel, using the inbound emails Message-ID
header as the value.
Below is an example where the inbound email is sent by the same human who will be responding to approval/human_as_tool requests.
These features are marked as experimental because we’re still working on documenting how different email providers handle threading why one or both of these headers are used.