reagentbuilder
Version:
An enterprise-grade AI agent framework based on LangChain and LangGraph, featuring dynamic tools, interceptors, breakpoints, and performance monitoring.
30 lines • 1.44 kB
TypeScript
import { BaseMessage } from "@langchain/core/messages";
import type { ToolCall } from "@langchain/core/messages/tool";
import type { AgentStateType, ToolResult, ProcessedToolCall } from "./agent.js";
export type InterceptorInput = ToolCall | ProcessedToolCall;
export type InterceptorOutput = string | ToolResult;
export interface InterceptorShortCircuitResult {
shortCircuit: true;
result: InterceptorOutput;
}
export interface InterceptorNormalResult {
shortCircuit: false;
modifiedInput: InterceptorInput;
}
export type InterceptorResult = InterceptorShortCircuitResult | InterceptorNormalResult;
export interface InterceptorConfig {
enabled: boolean;
core?: {
beforeModelInvoke?: (messages: BaseMessage[], state: AgentStateType) => Promise<BaseMessage[]>;
afterAgentComplete?: (finalState: AgentStateType) => Promise<AgentStateType>;
};
global?: {
beforeToolCall?: (toolCall: ToolCall, state: AgentStateType) => Promise<InterceptorResult>;
afterToolCall?: (result: InterceptorOutput, toolCall: ToolCall, state: AgentStateType) => Promise<InterceptorOutput>;
};
toolSpecific?: Map<string, {
beforeToolCall?: (toolCall: ToolCall, state: AgentStateType) => Promise<InterceptorResult>;
afterToolCall?: (result: InterceptorOutput, toolCall: ToolCall, state: AgentStateType) => Promise<InterceptorOutput>;
}>;
}
//# sourceMappingURL=interceptor.d.ts.map