@crewai-ts/core 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/a2a.d.ts +1684 -0
- package/dist/a2ui-schemas.d.ts +3312 -0
- package/dist/a2ui.d.ts +379 -0
- package/dist/agent-adapters.d.ts +178 -0
- package/dist/agent-executors.d.ts +508 -0
- package/dist/agent-parser.d.ts +44 -0
- package/dist/agent-planning.d.ts +358 -0
- package/dist/agent-utils.d.ts +210 -0
- package/dist/agent.d.ts +444 -0
- package/dist/auth.d.ts +179 -0
- package/dist/config-utils.d.ts +5 -0
- package/dist/content-processor.d.ts +12 -0
- package/dist/context.d.ts +157 -0
- package/dist/converter.d.ts +97 -0
- package/dist/crew-chat.d.ts +97 -0
- package/dist/crew.d.ts +424 -0
- package/dist/decorators.d.ts +20 -0
- package/dist/env.d.ts +13 -0
- package/dist/errors.d.ts +27 -0
- package/dist/evaluators.d.ts +477 -0
- package/dist/events.d.ts +2657 -0
- package/dist/execution-utils.d.ts +85 -0
- package/dist/experimental-conversational.d.ts +181 -0
- package/dist/file-handler.d.ts +36 -0
- package/dist/file-store.d.ts +37 -0
- package/dist/files.d.ts +554 -0
- package/dist/flow-conversation.d.ts +90 -0
- package/dist/flow-definition.d.ts +195 -0
- package/dist/flow-persistence.d.ts +107 -0
- package/dist/flow-visualization.d.ts +77 -0
- package/dist/flow.d.ts +927 -0
- package/dist/formatter.d.ts +7 -0
- package/dist/guardrail.d.ts +95 -0
- package/dist/hooks.d.ts +241 -0
- package/dist/human-input.d.ts +74 -0
- package/dist/i18n.d.ts +26 -0
- package/dist/index.d.ts +99 -13004
- package/dist/input-files.d.ts +24 -0
- package/dist/input-provider.d.ts +22 -0
- package/dist/knowledge.d.ts +353 -0
- package/dist/lite-agent-output.d.ts +69 -0
- package/dist/lite-agent.d.ts +154 -0
- package/dist/llm.d.ts +630 -0
- package/dist/llms-hooks-transport.d.ts +1 -2
- package/dist/lock-store.d.ts +14 -0
- package/dist/logger.d.ts +55 -0
- package/dist/mcp.d.ts +315 -0
- package/dist/memory.d.ts +915 -0
- package/dist/metadata.d.ts +9 -0
- package/dist/misc-compat.d.ts +125 -0
- package/dist/openai-completion.d.ts +324 -0
- package/dist/outputs.d.ts +69 -0
- package/dist/planning.d.ts +60 -0
- package/dist/plus-api.d.ts +194 -0
- package/dist/project-compat.d.ts +133 -0
- package/dist/project.d.ts +221 -0
- package/dist/prompts.d.ts +66 -0
- package/dist/provider-completions.d.ts +593 -0
- package/dist/rag.d.ts +1074 -0
- package/dist/rpm.d.ts +27 -0
- package/dist/rw-lock.d.ts +21 -0
- package/dist/schema-utils.d.ts +121 -0
- package/dist/security.d.ts +66 -0
- package/dist/settings.d.ts +103 -0
- package/dist/skills.d.ts +145 -0
- package/dist/state-provider-core.d.ts +1 -1
- package/dist/state.d.ts +204 -0
- package/dist/step-execution-context.d.ts +36 -0
- package/dist/streaming.d.ts +153 -0
- package/dist/string-utils.d.ts +12 -0
- package/dist/task-output-storage.d.ts +62 -0
- package/dist/task.d.ts +305 -0
- package/dist/telemetry.d.ts +91 -0
- package/dist/token-counter-callback.d.ts +36 -0
- package/dist/tools.d.ts +563 -0
- package/dist/tracing-utils.d.ts +56 -0
- package/dist/training-converter.d.ts +36 -0
- package/dist/training-handler.d.ts +10 -0
- package/dist/types.d.ts +72 -0
- package/dist/utilities.d.ts +130 -0
- package/dist/utility-types.d.ts +10 -0
- package/dist/version.d.ts +12 -0
- package/package.json +326 -4904
- package/dist/index.d.cts +0 -13068
- package/dist/llms-hooks-transport-ChGiFBiU.d.ts +0 -233
- package/dist/llms-hooks-transport-DZlurMUQ.d.cts +0 -233
- package/dist/llms-hooks-transport.d.cts +0 -2
- package/dist/state-provider-core-Be9RKRAm.d.cts +0 -4876
- package/dist/state-provider-core-Be9RKRAm.d.ts +0 -4876
- package/dist/state-provider-core.d.cts +0 -1
|
@@ -0,0 +1,508 @@
|
|
|
1
|
+
import { Agent, type AgentExecutionOptions } from "./agent.js";
|
|
2
|
+
import type { CheckpointConfig } from "./state.js";
|
|
3
|
+
import type { Crew } from "./crew.js";
|
|
4
|
+
import { PlanStep, StepObservation, TodoItem, TodoList } from "./agent-planning.js";
|
|
5
|
+
import { AgentAction, AgentFinish, parseAgentOutput } from "./agent-parser.js";
|
|
6
|
+
import { Converter } from "./converter.js";
|
|
7
|
+
import { UsageMetrics } from "./llm.js";
|
|
8
|
+
import { StepExecutionContext, StepResult } from "./step-execution-context.js";
|
|
9
|
+
import type { InputValues, LLMMessage, MaybePromise, Tool } from "./types.js";
|
|
10
|
+
export declare const ACTION_INPUT_REGEX: RegExp;
|
|
11
|
+
export declare const ACTION_REGEX: RegExp;
|
|
12
|
+
export declare const ACTION_INPUT_ONLY_REGEX: RegExp;
|
|
13
|
+
export type PlatformApp = Record<string, unknown>;
|
|
14
|
+
export declare const PlatformApp: Readonly<{
|
|
15
|
+
kind: "PlatformApp";
|
|
16
|
+
}>;
|
|
17
|
+
export type PlatformAppOrAction = PlatformApp | string | ((...args: unknown[]) => unknown);
|
|
18
|
+
export declare const PlatformAppOrAction: Readonly<{
|
|
19
|
+
kind: "PlatformAppOrAction";
|
|
20
|
+
}>;
|
|
21
|
+
export declare class BaseAgent extends Agent {
|
|
22
|
+
static fromCheckpoint(config: CheckpointConfig): Promise<BaseAgent>;
|
|
23
|
+
static from_checkpoint(config: CheckpointConfig): Promise<BaseAgent>;
|
|
24
|
+
static fork(config: CheckpointConfig, branch?: string | null): Promise<BaseAgent>;
|
|
25
|
+
static coerceSkillStrings(skills: unknown): unknown;
|
|
26
|
+
static coerce_skill_strings(skills: unknown): unknown;
|
|
27
|
+
static processModelConfig(values: Record<string, unknown>): Record<string, unknown>;
|
|
28
|
+
static process_model_config(values: Record<string, unknown>): Record<string, unknown>;
|
|
29
|
+
get key(): string;
|
|
30
|
+
getRole(): string;
|
|
31
|
+
get_role(): string;
|
|
32
|
+
copy(): BaseAgent;
|
|
33
|
+
executeTask(prompt: string, inputs?: {}, taskTools?: readonly Tool[], options?: AgentExecutionOptions): Promise<string>;
|
|
34
|
+
execute_task(promptOrOptions: Parameters<Agent["execute_task"]>[0], context?: string | null, tools?: readonly Tool[]): Promise<string>;
|
|
35
|
+
aexecuteTask(prompt: string, inputs?: InputValues, tools?: readonly Tool[], options?: AgentExecutionOptions): Promise<string>;
|
|
36
|
+
aexecuteTask(promptOrOptions: Parameters<Agent["execute_task"]>[0], context?: string | null, tools?: readonly Tool[]): Promise<string>;
|
|
37
|
+
aexecute_task(promptOrOptions: Parameters<Agent["aexecute_task"]>[0], context?: string | null, tools?: readonly Tool[]): Promise<string>;
|
|
38
|
+
createAgentExecutor(): unknown;
|
|
39
|
+
create_agent_executor(): unknown;
|
|
40
|
+
getDelegationTools(): readonly Tool[];
|
|
41
|
+
get_delegation_tools(): readonly Tool[];
|
|
42
|
+
getPlatformTools(): readonly Tool[];
|
|
43
|
+
get_platform_tools(): readonly Tool[];
|
|
44
|
+
getMcpTools(): readonly Tool[];
|
|
45
|
+
get_mcp_tools(): readonly Tool[];
|
|
46
|
+
interpolateInputs(inputs: Record<string, unknown>): void;
|
|
47
|
+
interpolate_inputs(inputs: Record<string, unknown>): void;
|
|
48
|
+
resolveMemory(): ReturnType<Agent["resolveMemory"]>;
|
|
49
|
+
resolve_memory(): ReturnType<Agent["resolveMemory"]>;
|
|
50
|
+
setCacheHandler(cacheHandler: Parameters<Agent["setCacheHandler"]>[0]): void;
|
|
51
|
+
set_cache_handler(cacheHandler: Parameters<Agent["setCacheHandler"]>[0]): void;
|
|
52
|
+
setKnowledge(knowledge: Parameters<Agent["setKnowledge"]>[0]): void;
|
|
53
|
+
set_knowledge(knowledge: Parameters<Agent["setKnowledge"]>[0]): void;
|
|
54
|
+
setPrivateAttrs(): this;
|
|
55
|
+
set_private_attrs(): this;
|
|
56
|
+
setRpmController(controller: Parameters<Agent["setRpmController"]>[0]): void;
|
|
57
|
+
set_rpm_controller(controller: Parameters<Agent["setRpmController"]>[0]): void;
|
|
58
|
+
setSkills(resolvedCrewSkills?: readonly unknown[] | null): void;
|
|
59
|
+
set_skills(resolvedCrewSkills?: readonly unknown[] | null): void;
|
|
60
|
+
validateAndSetAttributes(): this;
|
|
61
|
+
validate_and_set_attributes(): this;
|
|
62
|
+
validateApps(): this;
|
|
63
|
+
validate_apps(): this;
|
|
64
|
+
validateMcps(): this;
|
|
65
|
+
validate_mcps(): this;
|
|
66
|
+
validateTools(): this;
|
|
67
|
+
validate_tools(): this;
|
|
68
|
+
}
|
|
69
|
+
export type BaseAgentExecutorOptions = {
|
|
70
|
+
crew?: Crew | null;
|
|
71
|
+
agent?: Agent | null;
|
|
72
|
+
task?: unknown;
|
|
73
|
+
tools?: readonly Tool[];
|
|
74
|
+
originalTools?: readonly Tool[];
|
|
75
|
+
original_tools?: readonly Tool[];
|
|
76
|
+
maxIter?: number;
|
|
77
|
+
max_iter?: number;
|
|
78
|
+
messages?: readonly LLMMessage[];
|
|
79
|
+
llm?: unknown;
|
|
80
|
+
prompt?: Record<string, string> | null;
|
|
81
|
+
toolsNames?: string;
|
|
82
|
+
tools_names?: string;
|
|
83
|
+
toolsDescription?: string;
|
|
84
|
+
tools_description?: string;
|
|
85
|
+
stop?: readonly string[];
|
|
86
|
+
stop_words?: readonly string[];
|
|
87
|
+
requestWithinRpmLimit?: (() => boolean | Promise<boolean>) | null;
|
|
88
|
+
request_within_rpm_limit?: (() => boolean | Promise<boolean>) | null;
|
|
89
|
+
callbacks?: readonly unknown[];
|
|
90
|
+
stepCallback?: ((value: AgentAction | AgentFinish) => unknown) | null;
|
|
91
|
+
step_callback?: ((value: AgentAction | AgentFinish) => unknown) | null;
|
|
92
|
+
responseModel?: unknown;
|
|
93
|
+
response_model?: unknown;
|
|
94
|
+
respectContextWindow?: boolean;
|
|
95
|
+
respect_context_window?: boolean;
|
|
96
|
+
};
|
|
97
|
+
export declare class BaseAgentExecutor {
|
|
98
|
+
readonly executorType: string;
|
|
99
|
+
readonly executor_type: string;
|
|
100
|
+
readonly crew: Crew | null;
|
|
101
|
+
readonly agent: Agent | null;
|
|
102
|
+
readonly task: unknown;
|
|
103
|
+
readonly tools: readonly Tool[];
|
|
104
|
+
readonly originalTools: readonly Tool[];
|
|
105
|
+
readonly original_tools: readonly Tool[];
|
|
106
|
+
readonly llm: unknown;
|
|
107
|
+
readonly prompt: Record<string, string> | null;
|
|
108
|
+
readonly stop: readonly string[];
|
|
109
|
+
readonly stop_words: readonly string[];
|
|
110
|
+
readonly requestWithinRpmLimit: (() => boolean | Promise<boolean>) | null;
|
|
111
|
+
readonly request_within_rpm_limit: (() => boolean | Promise<boolean>) | null;
|
|
112
|
+
readonly callbacks: readonly unknown[];
|
|
113
|
+
readonly stepCallback: ((value: AgentAction | AgentFinish) => unknown) | null;
|
|
114
|
+
readonly step_callback: ((value: AgentAction | AgentFinish) => unknown) | null;
|
|
115
|
+
responseModel: unknown;
|
|
116
|
+
response_model: unknown;
|
|
117
|
+
readonly respectContextWindow: boolean;
|
|
118
|
+
readonly respect_context_window: boolean;
|
|
119
|
+
readonly maxIter: number;
|
|
120
|
+
readonly max_iter: number;
|
|
121
|
+
iterations: number;
|
|
122
|
+
messages: LLMMessage[];
|
|
123
|
+
constructor(options?: BaseAgentExecutorOptions);
|
|
124
|
+
invoke(input?: string | readonly LLMMessage[]): MaybePromise<unknown>;
|
|
125
|
+
ainvoke(input?: string | readonly LLMMessage[]): Promise<unknown>;
|
|
126
|
+
_save_to_memory(output: AgentFinish): void;
|
|
127
|
+
}
|
|
128
|
+
export declare class AgentExecutorState {
|
|
129
|
+
readonly id: `${string}-${string}-${string}-${string}-${string}`;
|
|
130
|
+
messages: LLMMessage[];
|
|
131
|
+
iterations: number;
|
|
132
|
+
current_answer: unknown;
|
|
133
|
+
is_finished: boolean;
|
|
134
|
+
ask_for_human_input: boolean;
|
|
135
|
+
use_native_tools: boolean;
|
|
136
|
+
pending_tool_calls: unknown[];
|
|
137
|
+
plan: string | null;
|
|
138
|
+
plan_ready: boolean;
|
|
139
|
+
todos: TodoList;
|
|
140
|
+
replan_count: number;
|
|
141
|
+
last_replan_reason: string | null;
|
|
142
|
+
observations: Record<number, StepObservation>;
|
|
143
|
+
execution_log: Array<Record<string, unknown>>;
|
|
144
|
+
constructor(options?: {
|
|
145
|
+
messages?: readonly LLMMessage[];
|
|
146
|
+
iterations?: number;
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
export declare class AgentExecutor extends BaseAgentExecutor {
|
|
150
|
+
readonly executorType = "experimental";
|
|
151
|
+
readonly executor_type = "experimental";
|
|
152
|
+
readonly state: AgentExecutorState;
|
|
153
|
+
private lastParserError;
|
|
154
|
+
private lastContextError;
|
|
155
|
+
private finalizeCalled;
|
|
156
|
+
private isExecuting;
|
|
157
|
+
private kickoffInput;
|
|
158
|
+
private plannerObserver;
|
|
159
|
+
private stepExecutor;
|
|
160
|
+
constructor(options?: BaseAgentExecutorOptions & {
|
|
161
|
+
state?: AgentExecutorState;
|
|
162
|
+
});
|
|
163
|
+
private bindStateBackedCompatibilityProperties;
|
|
164
|
+
get use_stop_words(): boolean;
|
|
165
|
+
generatePlan(): void;
|
|
166
|
+
generate_plan(): void;
|
|
167
|
+
_create_todos_from_plan(steps: readonly PlanStep[]): void;
|
|
168
|
+
observeStepResult(): "step_observed_low" | "step_observed_medium" | "step_observed_high";
|
|
169
|
+
observe_step_result(): ReturnType<AgentExecutor["observeStepResult"]>;
|
|
170
|
+
handleStepObservedLow(): "continue_plan" | "replan_now";
|
|
171
|
+
handle_step_observed_low(): ReturnType<AgentExecutor["handleStepObservedLow"]>;
|
|
172
|
+
handleStepObservedMedium(): "continue_plan" | "replan_now";
|
|
173
|
+
handle_step_observed_medium(): ReturnType<AgentExecutor["handleStepObservedMedium"]>;
|
|
174
|
+
decideNextAction(): "goal_achieved" | "replan_now" | "refine_and_continue" | "continue_plan";
|
|
175
|
+
decide_next_action(): ReturnType<AgentExecutor["decideNextAction"]>;
|
|
176
|
+
handleRefineAndContinue(): "has_todos";
|
|
177
|
+
handle_refine_and_continue(): "has_todos";
|
|
178
|
+
handleContinuePlan(): "has_todos" | "all_todos_complete";
|
|
179
|
+
handle_continue_plan(): ReturnType<AgentExecutor["handleContinuePlan"]>;
|
|
180
|
+
handleGoalAchieved(): "all_todos_complete";
|
|
181
|
+
handle_goal_achieved(): "all_todos_complete";
|
|
182
|
+
handleReplanNow(): "has_todos" | "all_todos_complete";
|
|
183
|
+
handle_replan_now(): ReturnType<AgentExecutor["handleReplanNow"]>;
|
|
184
|
+
checkTodosAvailable(): "has_todos" | "no_todos" | "planning_disabled";
|
|
185
|
+
check_todos_available(): ReturnType<AgentExecutor["checkTodosAvailable"]>;
|
|
186
|
+
getReadyTodosMethod(): "single_todo_ready" | "multiple_todos_ready" | "all_todos_complete" | "needs_replan";
|
|
187
|
+
get_ready_todos_method(): ReturnType<AgentExecutor["getReadyTodosMethod"]>;
|
|
188
|
+
executeTodoSequential(): MaybePromise<"step_executed" | "todo_injected">;
|
|
189
|
+
execute_todo_sequential(): ReturnType<AgentExecutor["executeTodoSequential"]>;
|
|
190
|
+
executeTodosParallel(): Promise<"parallel_todos_complete">;
|
|
191
|
+
execute_todos_parallel(): Promise<"parallel_todos_complete">;
|
|
192
|
+
afterParallelExecution(): "has_todos" | "all_todos_complete" | "needs_replan";
|
|
193
|
+
after_parallel_execution(): ReturnType<AgentExecutor["afterParallelExecution"]>;
|
|
194
|
+
initializeReasoning(): "initialized";
|
|
195
|
+
initialize_reasoning(): "initialized";
|
|
196
|
+
ensureForceFinalAnswer(): "agent_finished";
|
|
197
|
+
ensure_force_final_answer(): "agent_finished";
|
|
198
|
+
callLlmAndParse(): "parsed" | "parser_error" | "context_error";
|
|
199
|
+
call_llm_and_parse(): ReturnType<AgentExecutor["callLlmAndParse"]>;
|
|
200
|
+
callLlmNativeTools(): "native_tool_calls" | "native_finished" | "context_error" | "todo_satisfied";
|
|
201
|
+
call_llm_native_tools(): ReturnType<AgentExecutor["callLlmNativeTools"]>;
|
|
202
|
+
routeByAnswerType(): "execute_tool" | "agent_finished" | "todo_satisfied";
|
|
203
|
+
route_by_answer_type(): ReturnType<AgentExecutor["routeByAnswerType"]>;
|
|
204
|
+
executeToolAction(): "tool_completed" | "tool_result_is_final";
|
|
205
|
+
execute_tool_action(): ReturnType<AgentExecutor["executeToolAction"]>;
|
|
206
|
+
executeNativeTool(): "native_tool_completed" | "tool_result_is_final";
|
|
207
|
+
execute_native_tool(): ReturnType<AgentExecutor["executeNativeTool"]>;
|
|
208
|
+
checkNativeTodoCompletion(): "todo_satisfied" | "todo_not_satisfied";
|
|
209
|
+
check_native_todo_completion(): ReturnType<AgentExecutor["checkNativeTodoCompletion"]>;
|
|
210
|
+
continueIteration(): "check_iteration";
|
|
211
|
+
continue_iteration(): "check_iteration";
|
|
212
|
+
checkMaxIterations(): "force_final_answer" | "continue_reasoning" | "continue_reasoning_native";
|
|
213
|
+
check_max_iterations(): ReturnType<AgentExecutor["checkMaxIterations"]>;
|
|
214
|
+
checkTodoCompletion(): "todo_satisfied" | "todo_not_satisfied";
|
|
215
|
+
check_todo_completion(): ReturnType<AgentExecutor["checkTodoCompletion"]>;
|
|
216
|
+
markTodoComplete(): "todo_marked";
|
|
217
|
+
mark_todo_complete(): "todo_marked";
|
|
218
|
+
private todoCompletionResult;
|
|
219
|
+
checkMoreTodos(): "has_todos" | "all_todos_complete" | "needs_replan";
|
|
220
|
+
check_more_todos(): ReturnType<AgentExecutor["checkMoreTodos"]>;
|
|
221
|
+
incrementAndContinue(): "initialized";
|
|
222
|
+
increment_and_continue(): "initialized";
|
|
223
|
+
finalize(): "completed" | "skipped";
|
|
224
|
+
private canUseLastTodoResultAsFinalAnswer;
|
|
225
|
+
private synthesizeFinalAnswerFromTodos;
|
|
226
|
+
private promptString;
|
|
227
|
+
handleReplan(): "has_todos" | "no_todos";
|
|
228
|
+
handle_replan(): ReturnType<AgentExecutor["handleReplan"]>;
|
|
229
|
+
recoverFromParserError(): "initialized";
|
|
230
|
+
recover_from_parser_error(): "initialized";
|
|
231
|
+
recoverFromContextLength(): MaybePromise<"initialized">;
|
|
232
|
+
recover_from_context_length(): MaybePromise<"initialized">;
|
|
233
|
+
invoke(input?: string | readonly LLMMessage[] | Record<string, unknown>): MaybePromise<unknown>;
|
|
234
|
+
invokeAsync(inputs: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
235
|
+
invoke_async(inputs: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
236
|
+
ainvoke(input?: string | readonly LLMMessage[] | Record<string, unknown>): Promise<unknown>;
|
|
237
|
+
private invokeFromInputs;
|
|
238
|
+
private invokeFromInputsAsync;
|
|
239
|
+
private resetInvocationState;
|
|
240
|
+
injectFilesFromInputs(inputs: Record<string, unknown>): void;
|
|
241
|
+
_inject_files_from_inputs(inputs: Record<string, unknown>): void;
|
|
242
|
+
ainjectFilesFromInputs(inputs: Record<string, unknown>): Promise<void>;
|
|
243
|
+
_ainject_files_from_inputs(inputs: Record<string, unknown>): Promise<void>;
|
|
244
|
+
private collectFilesFromInputs;
|
|
245
|
+
private collectFilesFromInputsAsync;
|
|
246
|
+
private storedFiles;
|
|
247
|
+
private attachFilesToLastUserMessage;
|
|
248
|
+
private withLlmStopWords;
|
|
249
|
+
private withLlmStopWordsAsync;
|
|
250
|
+
private isPlanningEnabled;
|
|
251
|
+
private applyHumanFeedback;
|
|
252
|
+
_append_message_to_state(text: string, role?: "user" | "assistant" | "system"): void;
|
|
253
|
+
_is_training_mode(): boolean;
|
|
254
|
+
_handle_crew_training_output(result: unknown, humanFeedback?: string | null): void;
|
|
255
|
+
_show_start_logs(): void;
|
|
256
|
+
_show_logs(formattedAnswer: AgentAction | AgentFinish): void;
|
|
257
|
+
private invokeStepCallback;
|
|
258
|
+
private injectTodoContext;
|
|
259
|
+
private buildTodoPrompt;
|
|
260
|
+
private applyHumanFeedbackAsync;
|
|
261
|
+
private hasOriginalTools;
|
|
262
|
+
private activeResponseModel;
|
|
263
|
+
private openAiToolsForNativeCall;
|
|
264
|
+
private callExecutorLlm;
|
|
265
|
+
private callLlmWithMessages;
|
|
266
|
+
_getReasoningEffort(): "low" | "medium" | "high";
|
|
267
|
+
_get_reasoning_effort(): ReturnType<AgentExecutor["_getReasoningEffort"]>;
|
|
268
|
+
_shouldObserveSteps(): boolean;
|
|
269
|
+
_should_observe_steps(): boolean;
|
|
270
|
+
private planningConfigRecord;
|
|
271
|
+
_stepSuccessFromLog(stepNumber: number): boolean | null;
|
|
272
|
+
_step_success_from_log(step_number: number): boolean | null;
|
|
273
|
+
_ensurePlannerObserver(): PlannerObserver;
|
|
274
|
+
_ensure_planner_observer(): PlannerObserver;
|
|
275
|
+
_observeCompletedStep(options: {
|
|
276
|
+
completedStep?: TodoItem;
|
|
277
|
+
completed_step?: TodoItem;
|
|
278
|
+
result?: unknown;
|
|
279
|
+
allCompleted?: readonly TodoItem[];
|
|
280
|
+
all_completed?: readonly TodoItem[];
|
|
281
|
+
remainingTodos?: readonly TodoItem[];
|
|
282
|
+
remaining_todos?: readonly TodoItem[];
|
|
283
|
+
stepSuccess?: boolean | null;
|
|
284
|
+
step_success?: boolean | null;
|
|
285
|
+
}): StepObservation;
|
|
286
|
+
_observe_completed_step(options: Parameters<AgentExecutor["_observeCompletedStep"]>[0]): StepObservation;
|
|
287
|
+
_ensureStepExecutor(): StepExecutor;
|
|
288
|
+
_ensure_step_executor(): StepExecutor;
|
|
289
|
+
_buildContextForTodo(todo: TodoItem): StepExecutionContext;
|
|
290
|
+
_build_context_for_todo(todo: TodoItem): StepExecutionContext;
|
|
291
|
+
private _executePlanningTodo;
|
|
292
|
+
private routeFinishWithTodos;
|
|
293
|
+
private finishCurrentObservedTodo;
|
|
294
|
+
private shouldReplan;
|
|
295
|
+
private getMaxReplans;
|
|
296
|
+
private getMaxStepIterations;
|
|
297
|
+
private getStepTimeout;
|
|
298
|
+
private executeNativeToolCall;
|
|
299
|
+
private emitNativeToolUsageError;
|
|
300
|
+
private availableNativeFunctions;
|
|
301
|
+
private nativeToolByName;
|
|
302
|
+
private nativeToolMaxUsageLimit;
|
|
303
|
+
private nativeToolResultAsAnswer;
|
|
304
|
+
private incrementTaskToolErrors;
|
|
305
|
+
private triggerReplan;
|
|
306
|
+
private buildReplanContext;
|
|
307
|
+
private enhanceTaskForReplan;
|
|
308
|
+
private applyReplanOutput;
|
|
309
|
+
private reasoningEffort;
|
|
310
|
+
}
|
|
311
|
+
export declare class CrewAgentExecutorFlow extends AgentExecutor {
|
|
312
|
+
}
|
|
313
|
+
export declare class CrewAgentExecutor extends BaseAgentExecutor {
|
|
314
|
+
readonly llm: unknown;
|
|
315
|
+
readonly prompt: Record<string, string> | null;
|
|
316
|
+
readonly originalTools: readonly Tool[];
|
|
317
|
+
readonly original_tools: readonly Tool[];
|
|
318
|
+
readonly toolsNames: string;
|
|
319
|
+
readonly tools_names: string;
|
|
320
|
+
readonly toolsDescription: string;
|
|
321
|
+
readonly tools_description: string;
|
|
322
|
+
readonly stop: readonly string[];
|
|
323
|
+
askForHumanInput: boolean;
|
|
324
|
+
ask_for_human_input: boolean;
|
|
325
|
+
constructor(options?: BaseAgentExecutorOptions);
|
|
326
|
+
get use_stop_words(): boolean;
|
|
327
|
+
invoke(input?: string | readonly LLMMessage[] | Record<string, unknown>): MaybePromise<unknown>;
|
|
328
|
+
ainvoke(input?: string | readonly LLMMessage[] | Record<string, unknown>): Promise<unknown>;
|
|
329
|
+
_setup_messages(inputs: Record<string, unknown>): void;
|
|
330
|
+
static _format_prompt(prompt: string, inputs: Record<string, unknown>): string;
|
|
331
|
+
_format_prompt(prompt: string, inputs: Record<string, unknown>): string;
|
|
332
|
+
_invoke_loop(): MaybePromise<AgentFinish>;
|
|
333
|
+
_ainvoke_loop(): Promise<AgentFinish>;
|
|
334
|
+
_invoke_loop_react(): AgentFinish;
|
|
335
|
+
_ainvoke_loop_react(): Promise<AgentFinish>;
|
|
336
|
+
_invoke_loop_native_tools(): Promise<AgentFinish>;
|
|
337
|
+
_ainvoke_loop_native_tools(): Promise<AgentFinish>;
|
|
338
|
+
_invoke_loop_native_no_tools(): AgentFinish;
|
|
339
|
+
_ainvoke_loop_native_no_tools(): Promise<AgentFinish>;
|
|
340
|
+
_is_tool_call_list(response: readonly unknown[]): boolean;
|
|
341
|
+
_handle_human_feedback(formattedAnswer: AgentFinish): AgentFinish;
|
|
342
|
+
_ahandle_human_feedback(formattedAnswer: AgentFinish): Promise<AgentFinish>;
|
|
343
|
+
_is_training_mode(): boolean;
|
|
344
|
+
_format_feedback_message(feedback: string): LLMMessage;
|
|
345
|
+
_inject_multimodal_files(inputs?: {
|
|
346
|
+
files?: Record<string, unknown>;
|
|
347
|
+
} | null): void;
|
|
348
|
+
_ainject_multimodal_files(inputs?: {
|
|
349
|
+
files?: Record<string, unknown>;
|
|
350
|
+
} | null): Promise<void>;
|
|
351
|
+
_parse_native_tool_call(toolCall: unknown): [string, string, string | Record<string, unknown>] | null;
|
|
352
|
+
_append_assistant_tool_calls_message(parsedCalls: readonly [string, string, string | Record<string, unknown>][]): void;
|
|
353
|
+
_handle_native_tool_calls(toolCalls: readonly unknown[], availableFunctions: Record<string, (input?: unknown) => MaybePromise<unknown>>): Promise<AgentFinish | null>;
|
|
354
|
+
private shouldParallelizeNativeToolCalls;
|
|
355
|
+
_append_tool_result_and_check_finality(executionResult: {
|
|
356
|
+
callId?: string | null;
|
|
357
|
+
call_id?: string | null;
|
|
358
|
+
funcName?: string | null;
|
|
359
|
+
func_name?: string | null;
|
|
360
|
+
result?: unknown;
|
|
361
|
+
}): AgentFinish | null;
|
|
362
|
+
_execute_single_native_tool_call(options: {
|
|
363
|
+
callId?: string;
|
|
364
|
+
call_id?: string;
|
|
365
|
+
funcName?: string;
|
|
366
|
+
func_name?: string;
|
|
367
|
+
funcArgs?: string | Record<string, unknown>;
|
|
368
|
+
func_args?: string | Record<string, unknown>;
|
|
369
|
+
availableFunctions?: Record<string, (input?: unknown) => MaybePromise<unknown>>;
|
|
370
|
+
available_functions?: Record<string, (input?: unknown) => MaybePromise<unknown>>;
|
|
371
|
+
originalTool?: Tool | null;
|
|
372
|
+
original_tool?: Tool | null;
|
|
373
|
+
shouldExecute?: boolean;
|
|
374
|
+
should_execute?: boolean;
|
|
375
|
+
}): Promise<Record<string, unknown>>;
|
|
376
|
+
_invoke_step_callback(formattedAnswer: AgentAction | AgentFinish): void;
|
|
377
|
+
_ainvoke_step_callback(formattedAnswer: AgentAction | AgentFinish): Promise<void>;
|
|
378
|
+
_append_message(text: string, role?: "user" | "assistant" | "system"): void;
|
|
379
|
+
_append_message_to_state(text: string, role?: "user" | "assistant" | "system"): void;
|
|
380
|
+
_handle_agent_action(formattedAnswer: AgentAction, toolResult: {
|
|
381
|
+
result?: unknown;
|
|
382
|
+
result_as_answer?: boolean;
|
|
383
|
+
resultAsAnswer?: boolean;
|
|
384
|
+
}): AgentAction | AgentFinish;
|
|
385
|
+
_show_logs(_formattedAnswer: AgentAction | AgentFinish): void;
|
|
386
|
+
_handle_crew_training_output(result: unknown, humanFeedback?: string | null): void;
|
|
387
|
+
_show_start_logs(): void;
|
|
388
|
+
}
|
|
389
|
+
export type StepExecutorOptions = {
|
|
390
|
+
agent?: Agent | null;
|
|
391
|
+
task?: unknown;
|
|
392
|
+
tools?: readonly Tool[];
|
|
393
|
+
availableFunctions?: Record<string, unknown>;
|
|
394
|
+
available_functions?: Record<string, unknown>;
|
|
395
|
+
callbacks?: readonly unknown[];
|
|
396
|
+
requestWithinRpmLimit?: (() => boolean | Promise<boolean>) | null;
|
|
397
|
+
request_within_rpm_limit?: (() => boolean | Promise<boolean>) | null;
|
|
398
|
+
};
|
|
399
|
+
export declare class StepExecutor {
|
|
400
|
+
readonly agent: Agent | null;
|
|
401
|
+
readonly task: unknown;
|
|
402
|
+
readonly tools: readonly Tool[];
|
|
403
|
+
readonly availableFunctions: Record<string, unknown>;
|
|
404
|
+
readonly available_functions: Record<string, unknown>;
|
|
405
|
+
readonly callbacks: readonly unknown[];
|
|
406
|
+
readonly requestWithinRpmLimit: (() => boolean | Promise<boolean>) | null;
|
|
407
|
+
readonly request_within_rpm_limit: (() => boolean | Promise<boolean>) | null;
|
|
408
|
+
constructor(options?: StepExecutorOptions);
|
|
409
|
+
_parse_tool_args(toolInput: unknown): Record<string, unknown>;
|
|
410
|
+
static _parse_vision_sentinel(raw: string): [string, string] | null;
|
|
411
|
+
static _build_observation_message(toolResult: string): LLMMessage;
|
|
412
|
+
_build_observation_message(toolResult: string): LLMMessage;
|
|
413
|
+
_validate_expected_tool_usage(todo: TodoItem, toolCallsMade: readonly string[]): void;
|
|
414
|
+
_buildIsolatedMessages(todo: TodoItem, context: StepExecutionContext): LLMMessage[];
|
|
415
|
+
_build_isolated_messages(todo: TodoItem, context: StepExecutionContext): LLMMessage[];
|
|
416
|
+
_buildSystemPrompt(): string;
|
|
417
|
+
_build_system_prompt(): string;
|
|
418
|
+
_buildUserPrompt(todo: TodoItem, context: StepExecutionContext): string;
|
|
419
|
+
_build_user_prompt(todo: TodoItem, context: StepExecutionContext): string;
|
|
420
|
+
_executeTextParsed(messages: LLMMessage[], toolCallsMade: string[], maxStepIterations?: number, stepTimeout?: number | null, startTime?: number | null): Promise<string>;
|
|
421
|
+
_execute_text_parsed(messages: LLMMessage[], toolCallsMade: string[], maxStepIterations?: number, stepTimeout?: number | null, startTime?: number | null): Promise<string>;
|
|
422
|
+
_executeTextToolWithEvents(formatted: AgentAction): Promise<string>;
|
|
423
|
+
_execute_text_tool_with_events(formatted: AgentAction): Promise<string>;
|
|
424
|
+
_executeNativeToolCalls(toolCalls: readonly unknown[], messages: LLMMessage[], toolCallsMade: string[]): Promise<string>;
|
|
425
|
+
_execute_native_tool_calls(toolCalls: readonly unknown[], messages: LLMMessage[], toolCallsMade: string[]): Promise<string>;
|
|
426
|
+
_executeNative(messages: LLMMessage[], toolCallsMade: string[], maxStepIterations?: number, stepTimeout?: number | null, startTime?: number | null): Promise<string>;
|
|
427
|
+
_execute_native(messages: LLMMessage[], toolCallsMade: string[], maxStepIterations?: number, stepTimeout?: number | null, startTime?: number | null): Promise<string>;
|
|
428
|
+
executeStep(step: string, context?: StepExecutionContext, maxStepIterations?: number, stepTimeout?: number | null): Promise<StepResult>;
|
|
429
|
+
execute_step(step: string, context?: StepExecutionContext, max_step_iterations?: number, step_timeout?: number | null): Promise<StepResult>;
|
|
430
|
+
execute(todo: string | TodoItem, context?: StepExecutionContext, maxStepIterations?: number, stepTimeout?: number | null): Promise<StepResult>;
|
|
431
|
+
private executeTodoItem;
|
|
432
|
+
private hasNativeStepTools;
|
|
433
|
+
private _buildObservationMessage;
|
|
434
|
+
private callStepLlm;
|
|
435
|
+
private buildNativeStepLlmOptions;
|
|
436
|
+
private buildStepLlmOptions;
|
|
437
|
+
private runToolByName;
|
|
438
|
+
}
|
|
439
|
+
export declare class PlannerObserver {
|
|
440
|
+
readonly agent: unknown;
|
|
441
|
+
readonly task: unknown;
|
|
442
|
+
readonly kickoffInput: string;
|
|
443
|
+
readonly kickoff_input: string;
|
|
444
|
+
readonly llm: unknown;
|
|
445
|
+
constructor(agent?: unknown, task?: unknown, kickoffInput?: string);
|
|
446
|
+
_resolveLlm(): unknown;
|
|
447
|
+
_resolve_llm(): unknown;
|
|
448
|
+
observe(stepOrOptions: string | TodoItem | {
|
|
449
|
+
completedStep?: TodoItem;
|
|
450
|
+
completed_step?: TodoItem;
|
|
451
|
+
result?: unknown;
|
|
452
|
+
allCompleted?: readonly TodoItem[];
|
|
453
|
+
all_completed?: readonly TodoItem[];
|
|
454
|
+
remainingTodos?: readonly TodoItem[];
|
|
455
|
+
remaining_todos?: readonly TodoItem[];
|
|
456
|
+
}, result?: unknown, allCompleted?: readonly TodoItem[], remainingTodos?: readonly TodoItem[]): StepObservation;
|
|
457
|
+
static heuristicObservation(options: {
|
|
458
|
+
stepSuccess?: boolean;
|
|
459
|
+
step_success?: boolean;
|
|
460
|
+
result?: unknown;
|
|
461
|
+
}): StepObservation;
|
|
462
|
+
static heuristic_observation(options: {
|
|
463
|
+
step_success?: boolean;
|
|
464
|
+
stepSuccess?: boolean;
|
|
465
|
+
result?: unknown;
|
|
466
|
+
}): StepObservation;
|
|
467
|
+
heuristicObservation(step: string, result: unknown): StepObservation;
|
|
468
|
+
heuristic_observation(step: string, result: unknown): StepObservation;
|
|
469
|
+
applyRefinements(observation: StepObservation, remainingTodos: TodoItem[]): TodoItem[];
|
|
470
|
+
apply_refinements(observation: StepObservation, remaining_todos: TodoItem[]): TodoItem[];
|
|
471
|
+
_buildObservationMessages(completedStep: TodoItem, result: string, allCompleted: readonly TodoItem[], remainingTodos: readonly TodoItem[]): LLMMessage[];
|
|
472
|
+
_build_observation_messages(completed_step: TodoItem, result: string, all_completed: readonly TodoItem[], remaining_todos: readonly TodoItem[]): LLMMessage[];
|
|
473
|
+
static _parseObservationResponse(response: unknown): StepObservation;
|
|
474
|
+
_parseObservationResponse(response: unknown): StepObservation;
|
|
475
|
+
static _parse_observation_response(response: unknown): StepObservation;
|
|
476
|
+
_parse_observation_response(response: unknown): StepObservation;
|
|
477
|
+
}
|
|
478
|
+
export declare class OutputConverter<T = unknown> extends Converter<T> {
|
|
479
|
+
to_pydantic(currentAttempt?: number): Promise<T>;
|
|
480
|
+
to_json(currentAttempt?: number): Promise<string | import("./converter.js").ConverterError>;
|
|
481
|
+
}
|
|
482
|
+
export declare class TokenProcess {
|
|
483
|
+
readonly summary: UsageMetrics;
|
|
484
|
+
constructor(summary?: UsageMetrics);
|
|
485
|
+
get totalTokens(): number;
|
|
486
|
+
get total_tokens(): number;
|
|
487
|
+
get promptTokens(): number;
|
|
488
|
+
get prompt_tokens(): number;
|
|
489
|
+
get cachedPromptTokens(): number;
|
|
490
|
+
get cached_prompt_tokens(): number;
|
|
491
|
+
get completionTokens(): number;
|
|
492
|
+
get completion_tokens(): number;
|
|
493
|
+
get successfulRequests(): number;
|
|
494
|
+
get successful_requests(): number;
|
|
495
|
+
sumPromptTokens(tokensOrMessages: number | readonly LLMMessage[]): number;
|
|
496
|
+
sum_prompt_tokens(tokensOrMessages: number | readonly LLMMessage[]): number;
|
|
497
|
+
sumCompletionTokens(tokens: number): void;
|
|
498
|
+
sum_completion_tokens(tokens: number): void;
|
|
499
|
+
sumCachedPromptTokens(tokens: number): void;
|
|
500
|
+
sum_cached_prompt_tokens(tokens: number): void;
|
|
501
|
+
sumSuccessfulRequests(requests: number): void;
|
|
502
|
+
sum_successful_requests(requests: number): void;
|
|
503
|
+
process(text: string): UsageMetrics;
|
|
504
|
+
getSummary(): UsageMetrics;
|
|
505
|
+
get_summary(): UsageMetrics;
|
|
506
|
+
}
|
|
507
|
+
export declare function parseAgentStep(text: string): ReturnType<typeof parseAgentOutput>;
|
|
508
|
+
export declare const parse_agent_step: typeof parseAgentStep;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export declare const FINAL_ANSWER_ACTION = "Final Answer:";
|
|
2
|
+
export declare const MISSING_ACTION_AFTER_THOUGHT_ERROR_MESSAGE = "I did it wrong. Invalid Format: I missed the 'Action:' after 'Thought:'. I will do right next, and don't use a tool I have already used.\n";
|
|
3
|
+
export declare const MISSING_ACTION_INPUT_AFTER_ACTION_ERROR_MESSAGE = "I did it wrong. Invalid Format: I missed the 'Action Input:' after 'Action:'. I will do right next, and don't use a tool I have already used.\n";
|
|
4
|
+
export declare const FINAL_ANSWER_AND_PARSABLE_ACTION_ERROR_MESSAGE = "I did it wrong. Tried to both perform Action and give a Final Answer at the same time, I must do one or the other";
|
|
5
|
+
export declare const UNABLE_TO_REPAIR_JSON_RESULTS: Set<string>;
|
|
6
|
+
export declare class AgentAction {
|
|
7
|
+
readonly thought: string;
|
|
8
|
+
readonly tool: string;
|
|
9
|
+
readonly toolInput: string;
|
|
10
|
+
readonly tool_input: string;
|
|
11
|
+
readonly text: string;
|
|
12
|
+
readonly result: string | null;
|
|
13
|
+
constructor(options: {
|
|
14
|
+
thought: string;
|
|
15
|
+
tool: string;
|
|
16
|
+
toolInput?: string;
|
|
17
|
+
tool_input?: string;
|
|
18
|
+
text: string;
|
|
19
|
+
result?: string | null;
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
export declare class AgentFinish {
|
|
23
|
+
readonly thought: string;
|
|
24
|
+
readonly output: unknown;
|
|
25
|
+
readonly text: string;
|
|
26
|
+
constructor(options: {
|
|
27
|
+
thought: string;
|
|
28
|
+
output: unknown;
|
|
29
|
+
text: string;
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
export declare class OutputParserError extends Error {
|
|
33
|
+
readonly error: string;
|
|
34
|
+
constructor(error: string);
|
|
35
|
+
}
|
|
36
|
+
export declare function parseAgentOutput(text: string): AgentAction | AgentFinish;
|
|
37
|
+
export declare const parse: typeof parseAgentOutput;
|
|
38
|
+
export declare function extractThought(text: string): string;
|
|
39
|
+
export declare function cleanAction(text: string): string;
|
|
40
|
+
export declare function safeRepairJson(toolInput: string): string;
|
|
41
|
+
export declare const parse_agent_output: typeof parseAgentOutput;
|
|
42
|
+
export declare const _extract_thought: typeof extractThought;
|
|
43
|
+
export declare const _clean_action: typeof cleanAction;
|
|
44
|
+
export declare const _safe_repair_json: typeof safeRepairJson;
|