Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions libs/langchain/src/agents/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import type {
export * from "./types.js";
export * from "./errors.js";
export * from "./interrupt.js";
export * from "./annotation.js";
export { ToolNode } from "./nodes/ToolNode.js";
export {
toolStrategy,
Expand Down
17 changes: 1 addition & 16 deletions libs/langchain/src/agents/interrupt.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export { interrupt } from "@langchain/langgraph";
import type { ActionRequest } from "./middlewareAgent/middleware/hitl.js";

/**
* Represents information about an interrupt.
Expand Down Expand Up @@ -37,22 +38,6 @@ export interface HumanInterruptConfig {
allow_accept: boolean;
}

/**
* Represents a request for human action within the graph execution.
* Contains the action type and any associated arguments needed for the action.
*/
export interface ActionRequest {
/**
* The type or name of action being requested (e.g., "Approve XYZ action")
*/
action: string;
/**
* Key-value pairs of arguments needed for the action
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
args: Record<string, any>;
}

/**
* Represents an interrupt triggered by the graph that requires human intervention.
* This is passed to the `interrupt` function when execution is paused for human input.
Expand Down
14 changes: 0 additions & 14 deletions libs/langchain/src/agents/middlewareAgent/middleware/hitl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,6 @@ const ToolConfigSchema = z.object({
type ToolConfigSchema = z.input<typeof ToolConfigSchema>;
type ToolCall = NonNullable<AIMessage["tool_calls"]>[number];

/**
* Represents information about an interrupt.
*/
export interface Interrupt<TValue = unknown> {
/**
* The ID of the interrupt.
*/
id: string;
/**
* The requests for human input.
*/
value: TValue;
}

/**
* Configuration that defines which reviewer response types are permitted during a human interrupt.
* These flags control what the human reviewer may do (e.g., accept/edit/respond),
Expand Down
15 changes: 14 additions & 1 deletion libs/langchain/src/agents/middlewareAgent/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,25 @@ import type {
JsonSchemaFormat,
} from "../responses.js";
import type { ResponseFormatUndefined } from "../annotation.js";
import type { Interrupt } from "../interrupt.js";
import type { ToolNode } from "../nodes/ToolNode.js";
import type { ClientTool, ServerTool } from "../types.js";

export type N = typeof START | "model_request" | "tools";

/**
* Represents information about an interrupt.
*/
export interface Interrupt<TValue = unknown> {
/**
* The ID of the interrupt.
*/
id: string;
/**
* The requests for human input.
*/
value: TValue;
}

export interface BuiltInState {
messages: BaseMessage[];
__interrupt__?: Interrupt[];
Expand Down
17 changes: 1 addition & 16 deletions libs/langchain/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,7 @@ export {
/**
* LangChain Agents
*/
export {
createAgent,
createMiddleware,
toolStrategy,
providerStrategy,
ToolNode,
type ReactAgent,
type AgentState,
type AgentRuntime,
type AgentMiddleware,
type HumanInterrupt,
type HumanInterruptConfig,
type ActionRequest,
type HumanResponse,
type Interrupt,
} from "./agents/index.js";
export * from "./agents/index.js";

/**
* `createAgent` pre-built middleware
Expand Down