Real human approval for your AutoGen agents
AutoGen's human_input_mode parks the run at a terminal nobody is reading. ClearedBy moves the autogen-human-in-the-loop-approval onto the tool call itself: routine ones clear by policy, the consequential few wait for a named person.
The problem
The way AutoGen does a human in the loop is a UserProxyAgent set to human_input_mode="ALWAYS". It stops the group chat and waits for someone to type into stdin. Fine in a notebook. Useless the second that agent runs as a service, a scheduled job, or behind an API, where input() either hangs the worker forever or you switch it to "NEVER" and the agent starts firing refund.create and code.deploy with nobody accountable. The fallback most teams reach for is a line in the system prompt telling the model to "check with a human first" — which is a polite request the LLM can reason its way out of mid-conversation.
And once the process exits, the trail is gone. The approval was a string on stdin; there's no record tying that refund to the person who waved it through. You can't clear the routine 90-odd percent on autopilot, you can't prove who signed off when finance asks three weeks later, and nothing stops a second agent in the chat from calling the function the proxy was meant to be guarding.
How ClearedBy handles it
-
01
Put the gate on the tool, not the chat
Wrap the registered function with guard(), or have the agent call request_clearance before it runs. The check sits on the consequential call itself, so it holds the same whether the run is a live notebook or a headless worker.
-
02
Policy decides in milliseconds
A small refund inside your limits clears instantly and the conversation keeps going. A production deploy or a public reply gets held and sent to a named reviewer — no console prompt, no blocked worker waiting on stdin.
-
03
Someone clears it from the queue, Slack or their phone
Approve, reject, or send back for changes. Only after a verdict does the agent get a short-lived credential to act, so a misbehaving agent elsewhere in the group chat has nothing to route around the gate with.
-
04
The verdict gets sealed
Every decision — cleared, auto-cleared, rejected — lands in a hash-linked record bound to the person who signed it with a passkey. The answer to 'who approved this?' survives long after the AutoGen process has died.
import os, httpx
from autogen import register_function
GATE = "https://app.clearedby.com/v1/gate"
AUTH = {"Authorization": f"Bearer {os.environ['CLEAREDBY_API_KEY']}"}
def issue_refund(order: str, amount: float) -> str:
"""Refund an order — gated before it runs."""
r = httpx.post(GATE, headers=AUTH, json={
"action": "refund.create",
"params": {"order": order, "amount": amount},
}).json()
if r["status"] != "cleared":
return f"Refund {r['status']} — not run."
return payments.refund(order, amount)
register_function(issue_refund, caller=assistant, executor=user_proxy,
description="Refund an order")
FAQ
Do I have to rip out UserProxyAgent and human_input_mode?
No. Leave the group chat exactly as it is and set human_input_mode to NEVER for unattended runs. ClearedBy gates the registered function, so you still get a real person on the calls that matter.
What does the run do while an action sits in the queue?
The guarded tool call blocks until there's a verdict, so the agent physically cannot step past a held refund or deploy. The rest of the conversation isn't stuck behind someone watching a terminal.
Can it tell which agent in the chat made the call?
Yes. The action carries its context — the agent and the tool that fired it — so both the held item and the sealed record show exactly who proposed what.
Does this hold up for async and server-hosted agents?
It does. The gate lives on the tool call rather than stdin, so it behaves the same in async runs, behind an API, or inside a cron job. There's no input() to hang on.
How do I avoid approving routine calls forever?
Start in shadow mode with nothing blocked and watch what the agent does. As your policy proves out the routine cases, ClearedBy proposes loosening the rules, and the slice that needs a human keeps shrinking.
Related use cases
Let your agents run. Inside the rules you set.
AutoGen's human_input_mode parks the run at a terminal nobody is reading. ClearedBy moves the autogen-human-in-the-loop-approval onto the tool call itself: routine ones clear by policy, the consequential few wait for a named person.