Согласование действий человеком
Добавляйте безопасные контрольные точки в автономные процессы: человек проверяет или подтверждает рискованные действия до продолжения работы агента, сочетая автоматизацию с контролем.
«Согласование действий человеком» — бесплатный урок AI Agents with LangChain & Autonomous Workflows на CoddyKit. Это урок 4 из 4. Ты можешь прочитать весь урок бесплатно ниже — а потом практиковать его прямо в браузере с встроенным редактором кода и ИИ-репетитором 24/7. Это часть пути обучения AI Agents with LangChain & Autonomous Workflows, и твой прогресс синхронизируется между веб-версией и приложением CoddyKit. Курс AI Agents with LangChain & Autonomous Workflows содержит 4 уроков всего.
Части этого урока еще не переведены и отображаются на английском.
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.
Часто задаваемые вопросы
Урок «Согласование действий человеком» бесплатный?
Да — полный текст урока «Согласование действий человеком» бесплатно доступен здесь в веб-версии. Чтобы практиковать его интерактивно (встроенный редактор кода и ИИ-репетитор 24/7) и разблокировать остальной курс AI Agents with LangChain & Autonomous Workflows, подпишись на CoddyKit PRO. Курс AI Agents with LangChain & Autonomous Workflows содержит 4 уроков всего.
Чему я научусь в уроке «Согласование действий человеком»?
Добавляйте безопасные контрольные точки в автономные процессы: человек проверяет или подтверждает рискованные действия до продолжения работы агента, сочетая автоматизацию с контролем. Ты практикуешь AI Agents with LangChain & Autonomous Workflows с помощью реального кода, который запускаешь прямо в браузере, и ИИ-репетитор 24/7 отвечает на твои вопросы во время урока.
Нужен ли мне опыт, чтобы начать AI Agents with LangChain & Autonomous Workflows?
Предыдущий опыт не требуется. AI Agents with LangChain & Autonomous Workflows на CoddyKit структурирован для всех уровней — от новичков до продвинутых, поэтому ты можешь начать отсюда или с самого начала и учиться в своем темпе. Это урок 4 из 4.
Сколько времени занимает урок «Согласование действий человеком»?
Большинство уроков CoddyKit занимают около 5–10 минут. Каждый из них компактный и интерактивный, поэтому ты постоянно делаешь прогресс и продолжаешь с того же места в веб-версии и приложении.
Можно ли писать и запускать код в этом уроке AI Agents with LangChain & Autonomous Workflows?
Да. Каждый урок AI Agents with LangChain & Autonomous Workflows включает встроенный редактор кода, поэтому ты пишешь и запускаешь реальный код прямо в браузере и получаешь моментальную обратную связь от AI — локальная установка не требуется.
Все уроки этого курса
- Проектирование сложных рабочих процессов
- Асинхронное выполнение агентами
- Обработка ошибок и устойчивость
- Согласование действий человеком