Human-in-the-loop¶
Put a human inside an agent pipeline — as an approval gate, a form, or an
interactive REPL — without leaving the Agent abstraction. LazyBridge ships two
human engines and two sugar factories that return a plain Agent:
- Human approval —
HumanEngine/human_agent. A single-turn step: present a task to a person, collect their response (free text or a Pydantic form), return it as anEnvelope. Terminal or web UI. - Supervisor REPL —
SupervisorEngine/supervisor_agent. An interactive REPL the human drives: approve/continue, retry a named sub-agent with feedback, call tools, read the store — with an audit trail.
Ships in
lazybridge.ext.hil. Both are Engine classes you pass viaAgent(engine=…)(likeLLMEngineorPlan); thehuman_agent(...)/supervisor_agent(...)factories are the one-liner sugar and return anAgent. HiL lives inextrather than core because it's a workflow pattern, not a primitive every agent needs. Import fromlazybridge.ext.hil.
When to use which¶
| You need… | Use |
|---|---|
| A single approval / form / clarification turn | HumanEngine / human_agent |
| An interactive session: tools, agent-retry, store access, audit trail | SupervisorEngine / supervisor_agent (the REPL) |
| Only to check an LLM's output (no human) | verify= on a normal agent — not HiL |
| Unattended automation with a human fallback | Either engine with timeout= + default= set |
They behave as agents¶
human_agent(...) and supervisor_agent(...) return a real Agent — callable,
composable, and usable as a step or a tool:
from lazybridge import Agent, Plan, Step
from lazybridge.ext.hil import human_agent
ask_city = human_agent(name="ask_city") # terminal UI by default
pipeline = Agent(engine=Plan(Step(gather),
Step(ask_city, task="What city is the user in?"),
Step(finalise)),
name="address_normaliser")
Everything you already know — chain, parallel, Plan, routing — still works
around a human engine; it's just another engine.
See also¶
- Human approval —
HumanEnginereference. - Supervisor REPL —
SupervisorEnginereference. - Core tools overview — where HiL sits in the stack.
- Safety — guards and confirmation gates for outbound tools.