humanlayer  by humanlayer

SDK for human-in-the-loop AI agent workflows

Created 1 year ago
2,511 stars

Top 18.6% on SourcePulse

GitHubView on GitHub
1 Expert Loves This Project
Project Summary

HumanLayer provides an API and SDK for integrating human oversight into AI agent workflows, specifically for high-stakes function calls. It targets developers building agentic systems who need to ensure safety and reliability when AI agents interact with the real world, offering a mechanism for human approval and feedback.

How It Works

HumanLayer operates by instrumenting function calls within AI agent frameworks. It uses decorators like @hl.require_approval() to intercept calls to sensitive functions, routing them for human review via channels like Slack or email. Alternatively, hl.human_as_tool() allows agents to proactively solicit human input or feedback during execution. This approach deterministically guarantees human involvement, mitigating risks associated with LLM hallucinations or errors in critical operations.

Quick Start & Requirements

  • Install via pip: pip install humanlayer
  • Install via npm: npm install humanlayer
  • Supports Python and TypeScript/JavaScript.
  • Integrates with LLMs (OpenAI, Llama, Claude) and frameworks (LangChain, CrewAI, ControlFlow).
  • Examples available for LangChain, CrewAI, ControlFlow, and raw OpenAI client.
  • Official Docs: https://humanlayer.dev/docs/quickstart-python
  • Discord: https://humanlayer.dev/discord

Highlighted Details

  • @hl.require_approval() decorator for blocking function calls until human approval.
  • hl.human_as_tool() for general human interaction within agent workflows.
  • Omni-channel support for human contact (Slack, Email, Discord planned).
  • Granular routing of approvals to specific teams or individuals.
  • Framework-agnostic design, compatible with any LLM and tool-calling framework.

Maintenance & Community

  • Active development with a roadmap indicating planned features like SMS/RCS approvals and LlamaIndex support.
  • Open-source contributions are welcomed.
  • Community support available via Discord.

Licensing & Compatibility

  • Licensed under the Apache 2.0 License.
  • Permissive license suitable for commercial use and integration into closed-source applications.

Limitations & Caveats

Some integrations, like GripTape and Controlflow, are currently in Alpha status. Features such as SMS/RCS approvals, Discord approvals, and composite contact channels are still in the planning stages.

Health Check
Last Commit

19 hours ago

Responsiveness

1 day

Pull Requests (30d)
68
Issues (30d)
47
Star History
1,363 stars in the last 30 days

Explore Similar Projects

Starred by Edward Z. Yang Edward Z. Yang(Research Engineer at Meta; Maintainer of PyTorch), Anton Osika Anton Osika(Cofounder of Lovable), and
3 more.

gptme by gptme

0.3%
4k
CLI tool for terminal agent workflows
Created 2 years ago
Updated 20 hours ago
Starred by Elvis Saravia Elvis Saravia(Founder of DAIR.AI), Chip Huyen Chip Huyen(Author of "AI Engineering", "Designing Machine Learning Systems"), and
4 more.

activepieces by activepieces

0.9%
18k
Open-source Zapier alternative for AI workflow automation
Created 2 years ago
Updated 23 hours ago
Feedback? Help us improve.