Skip to main content

AI control layer for Langchain agents

Project description

Handlebar, Agent Control Layer (for Langchain Agents)

Handlebar is a runtime control layer for your AI agents.

Enforce deterministic rules on your agents as they act, so you can guarantee they don't violate your team's policies.

Without Handlebar With Handlebar
"Whoops the agent deleted prod DB" Deterministically block dangerous tool actions. Full auditability into what your agent tried to do.
"Our costs are ballooning with no way to control them" Track token usage and USD spend, and set hard limits on your agents. When the limit is reached, Handlebar can block the agent from taking further actions.
"Someone convinced the agent to leak another user's emails" Limit tool permissions to the user.
"The agent is going off-the-rails and spamming heavy APIs" Set rate limits on tool use and prevent runaway actions
"We can't be sure the agent isn't leaking sensitive data" Enforce hard data boundaries between tools and your output. Filter PII before it leaks through agent context

Features

  • Collects auditable event logs of your agent's actions
  • Block dangerous tools use (e.g. send_email(internalAddress) -> PASS | send_email(unknownperson@randomaddress.ru) -> BLOCK)
  • Block dangerous tool chaining (e.g. get_pii -> send_slack_message -> BLOCK: risk of data exfil)
  • Require human reviews on dangerous actions
  • Enforce hard cost budgets and token usage limits for your agents
  • Track usage from each enduser and enforce per-user budgets
  • Rate limit agent actions

How it works

  1. Wrap a Handlebar client (this codebase) around your agent
  2. The client sends event logs of your agent's actions to the Handlebar platform, where you can analyse them
  3. As your agent receives an action from the LLM, Handlebar intercepts and evaluates the proposed action against your configured policies
  4. If there are violations, Handlebar either permits the action, blocks it, or exits the run

Get started

You will need:

  • an agent...
  • Wrap your agent with a Handlebar client
  • Connect to the Handlebar platform
  • Configure policies to enforce on your agent

Wrap your agent with Handlebar

This repository is a monorepo containing installable packages for different Python agent building frameworks. We provide some pre-built wrappers for agent frameworks, with more on the way soon. If your agent is not directly supported, you can still easily plug Handlebar into your agent.

Framework Install command Where to read more
Langchain (Python) uv add handlebar-langchain
Langchain (Javascript) bun i @handlebar/langchain
google-adk uv add handlebar-google-adk Integration guide
Other frameworks + custom agents uv add handlebar-core Custom integration guide coming soon
Javascript agents (Langchain, Vercel ai etc.) bun i @handlebar/core Checkout the Handlebar JS codebase

Connect your agent to the Handlebar platform

The client SDKs interact with the Handlebar API to emit agent telemetry and event data it collects, and to evaluate your configured policies.

Sign up at https://app.gethandlebar.com.
If you are waitlisted, get in touch with us to get access.

Once on the platform, create an API key and activate your agent by setting the HANDLEBAR_API_KEY environment variable in your agent codebase.

Configure policies to enforce on your agent

On the platform you can create policies from simple templates: usage limits, dangerous tool use, GDPR, finance agents, and more.

Alternatively, run the Handlebar claude code skill to generate rules custom to your agent, by running:

npx skills add gethandlebar/agent-skills

Go to the skill repository for full instructions.

Get in touch

Please open an issue if you have any feedback, suggestions, or requests for framework support. Alternatively, book a call to talk to us about how Handlebar could help to protect your team's agents.

License

Apache 2.0. See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

handlebar_langchain-0.2.0.tar.gz (9.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

handlebar_langchain-0.2.0-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

Details for the file handlebar_langchain-0.2.0.tar.gz.

File metadata

  • Download URL: handlebar_langchain-0.2.0.tar.gz
  • Upload date:
  • Size: 9.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.28

File hashes

Hashes for handlebar_langchain-0.2.0.tar.gz
Algorithm Hash digest
SHA256 603f031c4db5d3c687c5234d88e8cee88edbdff50e2715698a78bda4f62b5e5b
MD5 ee741320e7ddb82da34fa8b74556d01f
BLAKE2b-256 6afc374a2f5beea5d14b4c16238cdef7aa1dd308ff3394267b2a209639a2ff11

See more details on using hashes here.

File details

Details for the file handlebar_langchain-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for handlebar_langchain-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 14f311aafe1ed527f74d70b3a78a9c8a0b074a30638ab8cb5805ddec87f572e4
MD5 4bc81e4e2f8d41974b1445de7ec3d93b
BLAKE2b-256 09243c8016c510e862b377209cfeea346f71cc9f0f5e5dbea4c146b6490b9cae

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page