- The Basic Usage method is the easiest way to create a human contact tool
- The Fetch Response method is useful if you want more control over the response handling
- The Creating / Fetching method gives you full control over the contact flow
- See Advanced Usage for concepts like response options and contact channels
Structure
Human contact tools are built on the Human Contact API.Methods
There are three main jobs-to-be-done that you can control when using human contact tools:- Creating the contact request
- Halting execution until the human responds
- Passing the response back to the LLM
Basic Usage
You can use thehuman_as_tool
method to create a tool that an LLM can use to contact a human.
The method returns a native python function that can be used as a tool in any LLM framework that supports
inferring tool structure from the function signature, docstring, and type hints.
- Creating the contact request
- Halting execution until the human responds
- Passing the response back to the LLM
Example
See 04-human_as_tool_linkedin.py for a full example.Fetch Response
You can use thefetch_human_response
method to halt execution until the human responds,
and receive a result that you can use to decide what to do next.
- Creating the contact request
- Halting execution until the human responds
- Handling the human’s response
Creating and Fetching
For maximum control over the contact flow, you can create and fetch responses separately. This is useful if you want to implement your own waiting logic or integrate with a custom event loop.- Creating the contact request
- Fetching the response status
- Halting execution until the human responds
- Handling the response
Advanced Usage
Response Options
You can provide structured response options to guide the human’s response:Contact Channels
HumanLayer supports multiple contact channels:- Slack (
SlackContactChannel
) - Email (
EmailContactChannel
) - SMS (
SMSContactChannel
) - WhatsApp (
WhatsAppContactChannel
)