approve)하거나, 실행 전에 수정(edit)하거나, 피드백과 함께 거부(reject)할 수 있습니다.
Interrupt 결정 유형
미들웨어는 사람이 interrupt에 응답할 수 있는 세 가지 내장 방법을 정의합니다:| 결정 유형 | 설명 | 사용 사례 예시 |
|---|---|---|
✅ approve | 작업을 그대로 승인하고 변경 없이 실행합니다. | 작성된 그대로 이메일 초안을 전송 |
✏️ edit | 수정 사항을 적용하여 도구 호출을 실행합니다. | 이메일을 보내기 전에 수신자를 변경 |
❌ reject | 도구 호출을 거부하고 대화에 설명을 추가합니다. | 이메일 초안을 거부하고 다시 작성하는 방법을 설명 |
interrupt_on에서 구성한 정책에 따라 달라집니다.
여러 도구 호출이 동시에 일시 중지되면 각 작업에 대해 별도의 결정이 필요합니다.
결정은 interrupt 요청에 나타나는 작업 순서와 동일한 순서로 제공되어야 합니다.
도구 인수를 수정할 때는 보수적으로 변경하세요. 원래 인수를 크게 수정하면 모델이 접근 방식을 재평가하여 도구를 여러 번 실행하거나 예상치 못한 작업을 수행할 수 있습니다.
Interrupt 구성
HITL을 사용하려면 에이전트를 생성할 때 에이전트의middleware 목록에 미들웨어를 추가하세요.
각 작업에 허용되는 결정 유형에 대한 도구 작업의 매핑으로 구성합니다. 미들웨어는 도구 호출이 매핑의 작업과 일치할 때 실행을 중단합니다.
You must configure a checkpointer to persist the graph state across interrupts.
In production, use a persistent checkpointer like
AsyncPostgresSaver. For testing or prototyping, use InMemorySaver.When invoking the agent, pass a config that includes the thread ID to associate execution with a conversation thread.
See the LangGraph interrupts documentation for details.Responding to interrupts
When you invoke the agent, it runs until it either completes or an interrupt is raised. An interrupt is triggered when a tool call matches the policy you configured ininterrupt_on. In that case, the invocation result will include an __interrupt__ field with the actions that require review. You can then present those actions to a reviewer and resume execution once decisions are provided.
Decision types
- ✅ approve
- ✏️ edit
- ❌ reject
Use
approve to approve the tool call as-is and execute it without changes.Execution lifecycle
The middleware defines anafter_model hook that runs after the model generates a response but before any tool calls are executed:
- The agent invokes the model to generate a response.
- The middleware inspects the response for tool calls.
- If any calls require human input, the middleware builds a
HITLRequestwithaction_requestsandreview_configsand calls interrupt. - The agent waits for human decisions.
- Based on the
HITLResponsedecisions, the middleware executes approved or edited calls, synthesizes ToolMessage’s for rejected calls, and resumes execution.
Custom HITL logic
For more specialized workflows, you can build custom HITL logic directly using the interrupt primitive and middleware abstraction. Review the execution lifecycle above to understand how to integrate interrupts into the agent’s operation.Connect these docs programmatically to Claude, VSCode, and more via MCP for real-time answers.