Frameworks
CrewAI
Use Humanlayer with CrewAI
Overview
Humanlayer integrates seamlessly with CrewAI to add human oversight to your AI applications. This guide shows you how to use Humanlayer with CrewAI.
Installation
Install the required packages:
Basic Example
Let’s create a simple math agent that performs basic arithmetic operations with human oversight.
How it Works
- We create a HumanLayer instance with an optional
run_id
to identify this agent in the approval history - Define two math functions as CrewAI tools using the
@tool
decorator - Use
@hl.require_approval()
to require human approval before themultiply
function can be called - Create a CrewAI agent with these tools and a task to perform
- The agent will request approval before executing the multiply function
Running the Example
- Set up your environment variables in
.env
- Run the example:
When the agent attempts to use the multiply
function, it will pause and request human approval through your configured contact channel (Slack, Email, etc).
Next Steps
- Learn more about require_approval
- Configure contact channels
- Explore response options
For more framework examples, see https://github.com/humanlayer/humanlayer/tree/main/examples