Approbations avec intervention humaine
Ajoutez des points de contrôle sûrs aux flux de travail autonomes, où une personne examine ou approuve les actions risquées avant que l’agent ne poursuive, pour équilibrer automatisation et contrôle.
Approbations avec intervention humaine est une leçon AI Agents with LangChain & Autonomous Workflows gratuite sur CoddyKit. Ceci est la leçon 4 sur 4. Tu peux lire la leçon complète ci-dessous gratuitement — puis la pratiquer en direct dans le navigateur avec un éditeur de code intégré et un tuteur IA 24/7. Elle fait partie du parcours d'apprentissage AI Agents with LangChain & Autonomous Workflows, et ta progression se synchronise sur le web et l'application CoddyKit. Le cours AI Agents with LangChain & Autonomous Workflows comprend 4 leçons au total.
Certaines parties de cette leçon n'ont pas encore été traduites et s'affichent en anglais.
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.
Questions Fréquemment Posées
La leçon « Approbations avec intervention humaine » est-elle gratuite ?
Oui — le texte complet de « Approbations avec intervention humaine » est gratuit à lire ici sur le web. Pour la pratiquer de manière interactive (un éditeur de code intégré et un tuteur IA 24/7) et déverrouiller le reste du cours AI Agents with LangChain & Autonomous Workflows, passe à CoddyKit PRO. Le cours AI Agents with LangChain & Autonomous Workflows comprend 4 leçons au total.
Qu'est-ce que j'apprendrai dans « Approbations avec intervention humaine » ?
Ajoutez des points de contrôle sûrs aux flux de travail autonomes, où une personne examine ou approuve les actions risquées avant que l’agent ne poursuive, pour équilibrer automatisation et contrôle. Tu pratiques AI Agents with LangChain & Autonomous Workflows avec du code pratique que tu exécutes directement dans le navigateur, et un tuteur IA 24/7 répond à tes questions au fur et à mesure que tu avances dans la leçon.
Dois-je avoir de l'expérience pour commencer AI Agents with LangChain & Autonomous Workflows ?
Aucune expérience préalable n'est requise. AI Agents with LangChain & Autonomous Workflows sur CoddyKit est structuré pour les débutants jusqu'aux apprenants avancés, donc tu peux commencer ici ou depuis le début et avancer à ton rythme. Ceci est la leçon 4 sur 4.
Combien de temps prend la leçon « Approbations avec intervention humaine » ?
La plupart des leçons CoddyKit prennent environ 5–10 minutes. Chacune est courte et interactive, tu progresses régulièrement et tu repiques exactement où tu t'es arrêté sur le web et l'app.
Peux-tu écrire et exécuter du code dans cette leçon AI Agents with LangChain & Autonomous Workflows ?
Oui. Chaque leçon AI Agents with LangChain & Autonomous Workflows inclut un éditeur de code intégré, tu écris et exécutes du vrai code directement dans ton navigateur et tu reçois des retours IA instantanés — aucune configuration locale requise.
Toutes les leçons de ce cours
- Concevoir des flux de travail complexes
- Exécution asynchrone des agents
- Gestion des erreurs et résilience
- Approbations avec intervention humaine