Approvazioni con intervento umano
Aggiungete checkpoint sicuri ai workflow autonomi, in cui una persona esamina o approva le azioni rischiose prima che l’agente proceda, bilanciando automazione e controllo.
Approvazioni con intervento umano è una lezione AI Agents with LangChain & Autonomous Workflows gratuita su CoddyKit. Questa è la lezione 4 di 4. Puoi leggere la lezione completa qui gratuitamente — poi esercitati direttamente nel browser con un editor di codice integrato e un tutor IA disponibile 24/7. Fa parte del percorso di apprendimento AI Agents with LangChain & Autonomous Workflows, e i tuoi progressi si sincronizzano tra il web e l'app CoddyKit. Il corso AI Agents with LangChain & Autonomous Workflows include 4 lezioni in totale.
Parti di questa lezione non sono ancora state tradotte e vengono mostrate in inglese.
Why Pause for Humans
Full autonomy is risky for high-stakes actions: sending money, deleting records, emailing customers. A mistake can be costly and irreversible.
Human-in-the-loop (HITL) inserts an approval step so a person confirms before the agent acts.
Where to Add Checkpoints
You do not need approval everywhere — only at sensitive points:
- Before destructive or irreversible operations
- Before external side effects (payments, emails)
- When the agent's confidence is low
Read-only steps can stay fully automatic.
The Interrupt Pattern
In LangGraph you mark nodes where the graph should pause. Execution stops, state is saved, and control returns to your application to await a decision.
graph = builder.compile(
checkpointer=memory,
interrupt_before=['execute_payment']
)Persisting State to Resume
To pause and resume later, the workflow needs a checkpointer that saves state under a thread id. The human might approve minutes or hours later.
config = {'configurable': {'thread_id': 'order-42'}}
result = graph.invoke(initial_state, config)Surfacing the Pending Action
When paused, inspect the saved state to show the human exactly what the agent wants to do — the tool, the arguments, and the reason.
state = graph.get_state(config)
print(state.next)
print(state.values['proposed_action'])Approve and Continue
If the human approves, resume the graph by invoking again with the same thread id. It picks up right where it paused.
graph.invoke(None, config) # resumeReject or Edit
Approval is not the only outcome. A human can reject the action or edit the agent's proposed arguments before continuing — for example fixing a wrong recipient.
graph.update_state(
config,
{'proposed_action': edited_action}
)
graph.invoke(None, config)Asynchronous Approvals
In production the human is not at a console. The pause sends a notification (Slack, email, a dashboard task); the resume happens when they click approve. The thread id ties the request to the right paused run.
Timeouts and Defaults
Decide what happens if no one responds. Options:
- Auto-reject after a timeout (safe default)
- Escalate to another approver
- Hold indefinitely for critical actions
Auditability
Log every approval decision: who approved, when, and what was executed. This audit trail is essential for compliance and for debugging agent behavior later.
Balancing Automation
Too many approvals defeat the purpose of automation; too few add risk. Start cautious, then remove checkpoints as you gain confidence in the agent for specific action types.
Quick Check
Test your HITL knowledge.
Recap
You learned to add human oversight to autonomous workflows:
- Insert approval checkpoints at risky steps only
- Use
interrupt_beforeplus a checkpointer to pause - Surface the proposed action, then approve, reject, or edit
- Handle async approvals, timeouts, and audit logging
Human-in-the-loop makes autonomy safe for high-stakes work.
Domande Frequenti
La lezione «Approvazioni con intervento umano» è gratuita?
Sì — il testo completo di «Approvazioni con intervento umano» è gratuito qui sul web. Per esercitarvi in modo interattivo (un editor di codice integrato e un tutor IA 24/7) e sbloccare il resto del corso AI Agents with LangChain & Autonomous Workflows, passa a CoddyKit PRO. Il corso AI Agents with LangChain & Autonomous Workflows include 4 lezioni in totale.
Cosa imparerò in «Approvazioni con intervento umano»?
Aggiungete checkpoint sicuri ai workflow autonomi, in cui una persona esamina o approva le azioni rischiose prima che l’agente proceda, bilanciando automazione e controllo. Eserciti AI Agents with LangChain & Autonomous Workflows con codice pratico che esegui direttamente nel browser, e un tutor IA 24/7 risponde alle tue domande mentre lavori sulla lezione.
Ho bisogno di esperienza per iniziare AI Agents with LangChain & Autonomous Workflows?
Non è richiesta alcuna esperienza precedente. AI Agents with LangChain & Autonomous Workflows su CoddyKit è strutturato per principianti e studenti avanzati, quindi puoi iniziare da qui o dall'inizio e procedere al tuo ritmo. Questa è la lezione 4 di 4.
Quanto tempo richiede la lezione «Approvazioni con intervento umano»?
La maggior parte delle lezioni CoddyKit richiede circa 5–10 minuti. Ogni lezione è breve e interattiva, quindi fai progressi costanti e riprendi esattamente da dove hai lasciato su web e app.
Posso scrivere ed eseguire codice in questa lezione AI Agents with LangChain & Autonomous Workflows?
Sì. Ogni lezione AI Agents with LangChain & Autonomous Workflows include un editor di codice integrato, quindi scrivi ed esegui codice reale direttamente nel tuo browser e ricevi feedback istantaneo dall'IA — nessuna configurazione locale necessaria.
Tutte le lezioni di questo corso
- Progettare workflow complessi
- Esecuzione asincrona degli agenti
- Gestione degli errori e resilienza
- Approvazioni con intervento umano