Adding human approval to LangChain tool calls in 12 lines of TypeScript

typescript dev.to

Last week we needed to add approval gates to a LangChain agent that sends customer emails. The agent worked fine. The problem was it worked too fine, and nobody reviewed what it was sending. Here’s the before-and-after. Before: ungoverned tool call import { DynamicStructuredTool } from "@langchain/core/tools"; import { z } from "zod"; const sendEmailTool = new DynamicStructuredTool({ name: "send_email", description: "Send an email to a customer", schema: z.object({ to:

Read Full Tutorial open_in_new
arrow_back Back to Tutorials