Agents with Human-in-loop and Tool Approval from HumanLayer
You can also check this cookbook in colab here
⭐ Star us on GitHub, join our Discord, or follow us on X
This notebook demonstrates how to set up and leverage CAMEL’s ability to interact with user (for approval or comments) during the execution of the tasks.
In this notebook, you’ll explore:
- CAMEL: A powerful multi-agent framework that enables Retrieval-Augmented Generation and multi-agent role-playing scenarios, allowing for sophisticated AI-driven tasks.
- HumanLayer: HumanLayer is an API and SDK that enables AI Agents to contact humans for feedback, input, and approvals.
- Human-in-loop: The ability for agent to consult human during the execution of the task.
- Human approval: The ability for agent ask approval to execute some tasks.
This cookbook demonstrates how to use HumanLayer functionality within CAMEL framework.
📦 Installation
First, install the CAMEL package with all its dependencies:
Next, install humanlayer python SDK:
🔑 Setting Up API Keys
Your can go to here to get API Key from OpenAI.
Your can go to here to get API Key from HumanLayer.
Alternatively, if running on Colab, you could save your API keys and tokens as Colab Secrets, and use them across notebooks.
To do so, comment out the above manual API key prompt code block(s), and uncomment the following codeblock.
⚠️ Don’t forget granting access to the API key you would be using to the current notebook.
👨 Tools that requires human approval
In this section, we’ll demonstrate how to define tools for Camel agent to use, and use HumanLayer to make some tools require human approval. First define two functions for agent to use, one of them requires human approval.
Next we define the CAMEL agents, then run the computation commands. Here we will need to login HumanLayer cloud platform to approve for the agent to use the multiply function.
🤖 Human-in-loop interaction
Sometimes we want the agent to ask user during the working process, in this case, we can equip agent with human toolkits, and be able to ask human via console. This example demonstrates the human-in-loop function:
🌟 Highlights
This notebook has guided you through setting up chat agents with the ability of Human-in-loop and Human approval.
Key tools utilized in this notebook include:
- CAMEL: A powerful multi-agent framework that enables Retrieval-Augmented Generation and multi-agent role-playing scenarios, allowing for sophisticated AI-driven tasks.
- HumanLayer: HumanLayer is an API and SDK that enables AI Agents to contact humans for feedback, input, and approvals.
- Human-in-loop: The ability for agent to consult human during the execution of the task.
- Human approval: The ability for agent ask approval to execute some tasks.
That’s everything: Got questions about 🐫 CAMEL-AI? Join us on Discord! Whether you want to share feedback, explore the latest in multi-agent systems, get support, or connect with others on exciting projects, we’d love to have you in the community! 🤝
Check out some of our other work:
-
🐫 Creating Your First CAMEL Agent free Colab
-
Graph RAG Cookbook free Colab
-
🧑⚖️ Create A Hackathon Judge Committee with Workforce free Colab
-
🔥 3 ways to ingest data from websites with Firecrawl & CAMEL free Colab
-
🦥 Agentic SFT Data Generation with CAMEL and Mistral Models, Fine-Tuned with Unsloth free Colab
Thanks from everyone at 🐫 CAMEL-AI
⭐ Star us on GitHub, join our Discord, or follow us on X