@cognipeer/agent-sdk 0.6.3 → 0.6.5
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/README.md +17 -3
- package/dist/index.cjs +571 -171
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +150 -5
- package/dist/index.d.ts +150 -5
- package/dist/index.mjs +569 -172
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -206,6 +206,24 @@ type AgentLimits = {
|
|
|
206
206
|
maxToolCalls?: number;
|
|
207
207
|
maxParallelTools?: number;
|
|
208
208
|
maxContextTokens?: number;
|
|
209
|
+
/**
|
|
210
|
+
* Cap on cumulative model output tokens across the whole invoke. Once
|
|
211
|
+
* exceeded the loop terminates after the current iteration with a
|
|
212
|
+
* `metadata` event explaining the reason and emits `finalAnswer` so callers
|
|
213
|
+
* can still recover the partial result.
|
|
214
|
+
*/
|
|
215
|
+
maxTotalOutputTokens?: number;
|
|
216
|
+
/**
|
|
217
|
+
* Cap on cumulative cost in USD. Requires `costEstimator` on the agent
|
|
218
|
+
* options to be a no-op-free check; otherwise this limit is ignored.
|
|
219
|
+
*/
|
|
220
|
+
maxCostUsd?: number;
|
|
221
|
+
/**
|
|
222
|
+
* Cap on total wall-clock time for the invoke in milliseconds. Identical
|
|
223
|
+
* semantics to `InvokeConfig.timeoutMs` but lives on the agent definition
|
|
224
|
+
* so server-side defaults can be enforced without per-call wiring.
|
|
225
|
+
*/
|
|
226
|
+
maxWallClockMs?: number;
|
|
209
227
|
};
|
|
210
228
|
type SmartAgentLimits = AgentLimits;
|
|
211
229
|
type TraceSinkFileConfig = {
|
|
@@ -262,6 +280,25 @@ type AgentOptions = {
|
|
|
262
280
|
* When omitted or `enabled=false` the agent behaves exactly as before.
|
|
263
281
|
*/
|
|
264
282
|
reasoning?: ReasoningConfig;
|
|
283
|
+
/**
|
|
284
|
+
* Optional drop-in token counter. When provided, all internal token
|
|
285
|
+
* estimates (summarization trigger, hard caps, context budget) use this
|
|
286
|
+
* function instead of the built-in character heuristic. Recommended:
|
|
287
|
+
* tiktoken / @anthropic-ai/tokenizer for production accuracy.
|
|
288
|
+
*/
|
|
289
|
+
tokenCounter?: (text: string) => number;
|
|
290
|
+
/**
|
|
291
|
+
* Pluggable cost estimator: returns USD cost for a single model call's
|
|
292
|
+
* usage. Used by the `maxCostUsd` budget limit. When omitted the SDK has
|
|
293
|
+
* no built-in pricing table and the cost limit is a no-op.
|
|
294
|
+
*/
|
|
295
|
+
costEstimator?: (args: {
|
|
296
|
+
modelName?: string;
|
|
297
|
+
inputTokens: number;
|
|
298
|
+
outputTokens: number;
|
|
299
|
+
cachedInputTokens?: number;
|
|
300
|
+
reasoningTokens?: number;
|
|
301
|
+
}) => number;
|
|
265
302
|
};
|
|
266
303
|
type ReasoningLevel = "low" | "medium" | "high";
|
|
267
304
|
type ReflectionCadence = "off" | "every_turn" | "after_tool" | "on_branch";
|
|
@@ -282,6 +319,18 @@ type ReflectionConfig = {
|
|
|
282
319
|
promptTemplate?: string;
|
|
283
320
|
/** When true emits `reflection` SmartAgent events. Default true. */
|
|
284
321
|
emitEvents?: boolean;
|
|
322
|
+
/**
|
|
323
|
+
* Hard cap on the number of reflection calls within a single invoke. Once
|
|
324
|
+
* the cap is hit subsequent qualifying turns no longer trigger reflection.
|
|
325
|
+
* Default: unlimited.
|
|
326
|
+
*/
|
|
327
|
+
maxPerRun?: number;
|
|
328
|
+
/**
|
|
329
|
+
* Minimum number of tool-bearing turns between reflections. Defaults to 1
|
|
330
|
+
* (reflect on every qualifying turn). Set to 2 to reflect every other tool
|
|
331
|
+
* turn, etc. Independent of `cadence`.
|
|
332
|
+
*/
|
|
333
|
+
everyNTurns?: number;
|
|
285
334
|
};
|
|
286
335
|
type NativeReasoningConfig = {
|
|
287
336
|
effort?: "minimal" | "low" | "medium" | "high";
|
|
@@ -418,7 +467,7 @@ type SmartAgentToolResponseConfig = {
|
|
|
418
467
|
/**
|
|
419
468
|
* Retention policy applied to all non-critical tool responses by the summarizer
|
|
420
469
|
* when it fires (context limit reached). Has no effect at execution time.
|
|
421
|
-
|
|
470
|
+
* Defaults to context.toolResponsePolicy, or the active runtime profile default.
|
|
422
471
|
*/
|
|
423
472
|
defaultPolicy?: ToolResponseRetentionPolicy;
|
|
424
473
|
/**
|
|
@@ -485,6 +534,10 @@ type SmartAgentOptions = {
|
|
|
485
534
|
* Unified reasoning configuration. Same shape as on `AgentOptions`. See `ReasoningConfig`.
|
|
486
535
|
*/
|
|
487
536
|
reasoning?: ReasoningConfig;
|
|
537
|
+
/** See AgentOptions.tokenCounter. */
|
|
538
|
+
tokenCounter?: (text: string) => number;
|
|
539
|
+
/** See AgentOptions.costEstimator. */
|
|
540
|
+
costEstimator?: AgentOptions["costEstimator"];
|
|
488
541
|
};
|
|
489
542
|
type AgentRuntimeConfig = {
|
|
490
543
|
name?: string;
|
|
@@ -1098,7 +1151,29 @@ type AgentInstance<TOutput = unknown> = {
|
|
|
1098
1151
|
type SmartAgentInstance<TOutput = unknown> = AgentInstance<TOutput>;
|
|
1099
1152
|
|
|
1100
1153
|
type SmartToolFn = (args: any) => Promise<any> | any;
|
|
1101
|
-
|
|
1154
|
+
type ToolCachePolicy = {
|
|
1155
|
+
/** Cache scope. "run" persists for the current invoke only. */
|
|
1156
|
+
scope?: "run";
|
|
1157
|
+
/** Override the cache key (default: stable JSON of args). */
|
|
1158
|
+
keyFn?: (args: any) => string;
|
|
1159
|
+
/** Time-to-live for the cached value, in ms. Default: full invoke. */
|
|
1160
|
+
ttlMs?: number;
|
|
1161
|
+
};
|
|
1162
|
+
type ToolRetryPolicy = {
|
|
1163
|
+
/** Max retry attempts after the initial failure. Default: 0. */
|
|
1164
|
+
maxRetries?: number;
|
|
1165
|
+
/** Initial backoff in ms (doubled on each retry). Default: 250. */
|
|
1166
|
+
backoffMs?: number;
|
|
1167
|
+
/** Decide whether an error is worth retrying. Default: every error. */
|
|
1168
|
+
shouldRetry?: (err: unknown, attempt: number) => boolean;
|
|
1169
|
+
/**
|
|
1170
|
+
* Open a circuit-breaker after this many consecutive failures across the
|
|
1171
|
+
* invoke; once tripped the tool short-circuits with the breaker error
|
|
1172
|
+
* until the loop ends. Default: never trip.
|
|
1173
|
+
*/
|
|
1174
|
+
circuitBreakerThreshold?: number;
|
|
1175
|
+
};
|
|
1176
|
+
declare function createTool({ name, description, schema, func, needsApproval, approvalPrompt, approvalDefaults, maxExecutionsPerRun, cache, retry, }: {
|
|
1102
1177
|
name: string;
|
|
1103
1178
|
description?: string;
|
|
1104
1179
|
schema: ZodSchema;
|
|
@@ -1107,6 +1182,10 @@ declare function createTool({ name, description, schema, func, needsApproval, ap
|
|
|
1107
1182
|
approvalPrompt?: string;
|
|
1108
1183
|
approvalDefaults?: any;
|
|
1109
1184
|
maxExecutionsPerRun?: number | null;
|
|
1185
|
+
/** When set, identical args within the same invoke short-circuit to the cached result. */
|
|
1186
|
+
cache?: boolean | ToolCachePolicy;
|
|
1187
|
+
/** Per-tool retry + circuit-breaker policy. */
|
|
1188
|
+
retry?: ToolRetryPolicy;
|
|
1110
1189
|
}): ToolInterface;
|
|
1111
1190
|
|
|
1112
1191
|
declare function buildSystemPrompt(extra?: string, planning?: boolean | PlanningMode, name?: string, todoListPrompt?: string): string;
|
|
@@ -1137,15 +1216,30 @@ declare function createToolLimitFinalizeNode(_opts: SmartAgentOptions): (state:
|
|
|
1137
1216
|
*/
|
|
1138
1217
|
declare function createContextSummarizeNode(opts: SmartAgentOptions): (state: SmartState) => Promise<Partial<SmartState>>;
|
|
1139
1218
|
|
|
1219
|
+
/**
|
|
1220
|
+
* Token counter contract used across the SDK. The default is a
|
|
1221
|
+
* character-based heuristic; users can swap in a real tokenizer (tiktoken,
|
|
1222
|
+
* @anthropic-ai/tokenizer, …) via SmartAgentOptions.tokenCounter.
|
|
1223
|
+
*/
|
|
1224
|
+
type TokenCounter = (text: string) => number;
|
|
1140
1225
|
/**
|
|
1141
1226
|
* Estimates token count from text using a character-based heuristic.
|
|
1142
1227
|
*
|
|
1143
|
-
*
|
|
1228
|
+
* Approximation:
|
|
1144
1229
|
* - For Latin/ASCII text: ~4 characters per token (GPT-family models)
|
|
1145
1230
|
* - For CJK/Unicode text: ~1.5 characters per token
|
|
1146
1231
|
*
|
|
1147
|
-
* For production accuracy,
|
|
1232
|
+
* For production accuracy, pass a `tokenCounter` option backed by tiktoken.
|
|
1233
|
+
*/
|
|
1234
|
+
declare function defaultTokenCounter(text: string): number;
|
|
1235
|
+
/**
|
|
1236
|
+
* Installs a custom token counter used by every callable in this module
|
|
1237
|
+
* (countApproxTokens, countMessagesTokens). Pass `undefined` or
|
|
1238
|
+
* `defaultTokenCounter` to restore the heuristic.
|
|
1148
1239
|
*/
|
|
1240
|
+
declare function setTokenCounter(counter?: TokenCounter | null): void;
|
|
1241
|
+
declare function getTokenCounter(): TokenCounter;
|
|
1242
|
+
/** Backwards-compatible alias that delegates to the active counter. */
|
|
1149
1243
|
declare function countApproxTokens(text: string): number;
|
|
1150
1244
|
/**
|
|
1151
1245
|
* Estimates the total token count for an array of messages.
|
|
@@ -1624,6 +1718,16 @@ type ChatCompletionChunk = {
|
|
|
1624
1718
|
usage?: TokenUsage;
|
|
1625
1719
|
finishReason?: FinishReason;
|
|
1626
1720
|
};
|
|
1721
|
+
type ProviderRetryConfig = {
|
|
1722
|
+
/** Maximum retries on 429/5xx (default 3). */
|
|
1723
|
+
maxRetries?: number;
|
|
1724
|
+
/** Initial delay between retries in ms (default 500, doubled each attempt). */
|
|
1725
|
+
baseDelayMs?: number;
|
|
1726
|
+
/** Hard cap on a single retry delay in ms (default 8000). */
|
|
1727
|
+
maxDelayMs?: number;
|
|
1728
|
+
/** Custom predicate to opt in/out of a specific retry. */
|
|
1729
|
+
shouldRetry?: (error: any, attempt: number) => boolean;
|
|
1730
|
+
};
|
|
1627
1731
|
type OpenAIProviderConfig = {
|
|
1628
1732
|
provider: "openai";
|
|
1629
1733
|
apiKey: string;
|
|
@@ -1631,6 +1735,7 @@ type OpenAIProviderConfig = {
|
|
|
1631
1735
|
organization?: string;
|
|
1632
1736
|
defaultModel?: string;
|
|
1633
1737
|
defaultHeaders?: Record<string, string>;
|
|
1738
|
+
retry?: ProviderRetryConfig;
|
|
1634
1739
|
};
|
|
1635
1740
|
type AnthropicProviderConfig = {
|
|
1636
1741
|
provider: "anthropic";
|
|
@@ -1639,6 +1744,15 @@ type AnthropicProviderConfig = {
|
|
|
1639
1744
|
defaultModel?: string;
|
|
1640
1745
|
defaultHeaders?: Record<string, string>;
|
|
1641
1746
|
anthropicVersion?: string;
|
|
1747
|
+
retry?: ProviderRetryConfig;
|
|
1748
|
+
/**
|
|
1749
|
+
* Prompt caching configuration. When enabled, places cache_control:
|
|
1750
|
+
* ephemeral breakpoints on the system prompt and the final tool definition,
|
|
1751
|
+
* which is the recommended Anthropic recipe for static system + tools.
|
|
1752
|
+
*/
|
|
1753
|
+
prompt_caching?: {
|
|
1754
|
+
enabled: boolean;
|
|
1755
|
+
};
|
|
1642
1756
|
};
|
|
1643
1757
|
type AzureProviderConfig = {
|
|
1644
1758
|
provider: "azure";
|
|
@@ -1664,6 +1778,15 @@ type BedrockProviderConfig = {
|
|
|
1664
1778
|
sessionToken?: string;
|
|
1665
1779
|
defaultModel?: string;
|
|
1666
1780
|
defaultHeaders?: Record<string, string>;
|
|
1781
|
+
retry?: ProviderRetryConfig;
|
|
1782
|
+
/**
|
|
1783
|
+
* Insert Bedrock Converse `cachePoint` blocks at the end of the system
|
|
1784
|
+
* prompt and tools list. Only supported by models that implement Converse
|
|
1785
|
+
* prompt caching (most Anthropic Claude variants on Bedrock).
|
|
1786
|
+
*/
|
|
1787
|
+
prompt_caching?: {
|
|
1788
|
+
enabled: boolean;
|
|
1789
|
+
};
|
|
1667
1790
|
};
|
|
1668
1791
|
type VertexProviderConfig = {
|
|
1669
1792
|
provider: "vertex";
|
|
@@ -1683,12 +1806,32 @@ declare class ProviderError extends Error {
|
|
|
1683
1806
|
constructor(message: string, provider: string, statusCode?: number | undefined, responseBody?: any | undefined);
|
|
1684
1807
|
}
|
|
1685
1808
|
|
|
1809
|
+
type ProviderRetryPolicy = {
|
|
1810
|
+
/** Maximum number of retries on 429/5xx responses. Default: 3. */
|
|
1811
|
+
maxRetries?: number;
|
|
1812
|
+
/** Initial backoff in ms (doubled on each retry). Default: 500. */
|
|
1813
|
+
baseDelayMs?: number;
|
|
1814
|
+
/** Hard cap on individual delay between retries. Default: 8000. */
|
|
1815
|
+
maxDelayMs?: number;
|
|
1816
|
+
/**
|
|
1817
|
+
* Custom predicate to decide whether to retry. By default we retry 429
|
|
1818
|
+
* and 5xx responses; pass a function to broaden/narrow that set.
|
|
1819
|
+
*/
|
|
1820
|
+
shouldRetry?: (error: any, attempt: number) => boolean;
|
|
1821
|
+
};
|
|
1686
1822
|
declare abstract class BaseProvider {
|
|
1687
1823
|
abstract readonly providerName: ProviderType;
|
|
1824
|
+
protected retryPolicy: ProviderRetryPolicy;
|
|
1688
1825
|
/** Non-streaming completion */
|
|
1689
1826
|
abstract complete(request: ChatCompletionRequest): Promise<ChatCompletionResponse>;
|
|
1690
1827
|
/** Streaming completion – yields incremental chunks */
|
|
1691
1828
|
abstract completeStream(request: ChatCompletionRequest): AsyncGenerator<ChatCompletionChunk, void, unknown>;
|
|
1829
|
+
/**
|
|
1830
|
+
* Helper concrete providers can wrap their fetch with. Retries 429/5xx
|
|
1831
|
+
* with exponential backoff and respects Retry-After if the response
|
|
1832
|
+
* carries one.
|
|
1833
|
+
*/
|
|
1834
|
+
protected doFetchWithRetry(execute: () => Promise<Response>): Promise<Response>;
|
|
1692
1835
|
}
|
|
1693
1836
|
|
|
1694
1837
|
declare class OpenAIProvider extends BaseProvider {
|
|
@@ -1715,6 +1858,7 @@ declare class AnthropicProvider extends BaseProvider {
|
|
|
1715
1858
|
private readonly defaultModel;
|
|
1716
1859
|
private readonly defaultHeaders;
|
|
1717
1860
|
private readonly anthropicVersion;
|
|
1861
|
+
private readonly promptCachingEnabled;
|
|
1718
1862
|
constructor(config: AnthropicProviderConfig);
|
|
1719
1863
|
complete(request: ChatCompletionRequest): Promise<ChatCompletionResponse>;
|
|
1720
1864
|
completeStream(request: ChatCompletionRequest): AsyncGenerator<ChatCompletionChunk, void, unknown>;
|
|
@@ -1747,6 +1891,7 @@ declare class BedrockProvider extends BaseProvider {
|
|
|
1747
1891
|
private readonly credentials;
|
|
1748
1892
|
private readonly defaultModel;
|
|
1749
1893
|
private readonly defaultHeaders;
|
|
1894
|
+
private readonly promptCachingEnabled;
|
|
1750
1895
|
constructor(config: BedrockProviderConfig);
|
|
1751
1896
|
complete(request: ChatCompletionRequest): Promise<ChatCompletionResponse>;
|
|
1752
1897
|
completeStream(request: ChatCompletionRequest): AsyncGenerator<ChatCompletionChunk, void, unknown>;
|
|
@@ -1830,4 +1975,4 @@ declare function fromNativeProvider(provider: BaseProvider, options?: NativeMode
|
|
|
1830
1975
|
*/
|
|
1831
1976
|
declare function createProvider(config: ProviderConfig): BaseProvider;
|
|
1832
1977
|
|
|
1833
|
-
export { type AIMessage, type AgentInstance, type AgentInvokeResult, type AgentLimits, type AgentOptions, type AgentRuleOptions, type AgentRuntimeConfig, type AgentSnapshot, type AgentSnapshotMetadata, type AgentState, AnthropicProvider, type AnthropicProviderConfig, AzureProvider, type AzureProviderConfig, type BaseChatMessage, type BaseChatMessagePart, type BaseChatModel, type BaseMessage, BaseProvider, BedrockProvider, type BedrockProviderConfig, type BuiltInRuntimeProfile, type CancellationTokenLike, type CancelledEvent, type ChatCompletionChunk, type ChatCompletionRequest, type ChatCompletionResponse, type ChildContextPolicy, type CodeDetectionRuleOptions, type CodeGuardrailOptions, type ContextPolicy, type ContextToolsStateRef, type ConversationGuardrail, type CustomRuleCallback, type CustomRuleOptions, DEFAULT_PROFILE_CONFIGS, type DelegationMode, type EvalCase, type EvalCaseResult, type EvalFamily, type EvalHarnessMetrics, type EvalHarnessParams, type EvalHarnessResult, type EvalProfileDescriptor, type EvalProfileTarget, type FinalAnswerEvent, type FinishReason, type GuardrailContext, type GuardrailDisposition, type GuardrailEvent, type GuardrailIncident, type GuardrailOutcome, GuardrailPhase, type GuardrailRule, type HandoffDescriptor, type HandoffEvent, InMemoryMemoryStore, type InvokeConfig, type JsonGuardrailOptions, type JsonSchemaRuleOptions, type MemoryFact, type MemoryProviderKind, type MemoryReadPolicy, type MemoryScope, type MemoryStore, type MemoryWritePolicy, type Message, type MetadataEvent, type ModelCapabilities, NativeJsonSchemaStrategy, type NativeModelOptions, type NativeReasoningConfig, OpenAICompatibleProvider, type OpenAICompatibleProviderConfig, OpenAIProvider, type OpenAIProviderConfig, type PendingToolApproval, type PlanEvent, type PlanStepRecord, type PlanningMode, type ProfileConfig, type ProgressEvent, type ProgressUpdate, type ProviderConfig, ProviderError, type ToolCall as ProviderToolCall, type ToolDefinition as ProviderToolDefinition, type ProviderType, type ReasoningConfig, type ReasoningLevel, type ReflectionCadence, type ReflectionConfig, type ReflectionEvent, type ReflectionRecord, type RegexGuardrailOptions, type RegexRuleOptions, type ReplanPolicy, type ResolvedSmartAgentConfig, type ResolvedTraceConfig, type ResolvedTraceSink, type RestoreSnapshotOptions, type RuntimeProfile, type SerializableSmartState, type SmartAgentBudgetConfig, type SmartAgentContextConfig, type SmartAgentCustomProfileConfig, type SmartAgentDelegationConfig, type SmartAgentEvent, type SmartAgentInstance, type SmartAgentLimits, type SmartAgentMemoryConfig, type SmartAgentOptions, type SmartAgentPlanningConfig, type SmartAgentSummarizationConfig, type SmartAgentToolResponseConfig, type SmartAgentTracingConfig, type SmartModel, type SmartState, type SmartToolFn, type SnapshotOptions, type SnapshotRuntimeHint, type StreamChunk, type StreamEvent, type StructuredOutputError, type StructuredOutputFieldError, StructuredOutputManager, type StructuredOutputManagerConfig, type StructuredOutputResult, type StructuredOutputStrategy, type StructuredSummary, type SummarizationEvent, type SummarizationMode, type SummaryFactItem, type SummaryIntegrityCheck, type TokenUsage, type ToolApprovalEvent, type ToolApprovalResolution, type ToolApprovalStatus, ToolBasedStrategy, type ToolCallEvent, type ToolInterface, type ToolResponseClassification, type ToolResponseRetentionPolicy, type TraceDataSection, type TraceErrorRecord, type TraceEventRecord, type TraceMessageSection, type TraceMetadataSection, type TraceSessionConfigSnapshot, type TraceSessionFile, type TraceSessionStatus, type TraceSessionSummary, type TraceSinkCognipeerConfig, type TraceSinkConfig, type TraceSinkCustomConfig, type TraceSinkFileConfig, type TraceSinkHttpConfig, type TraceSinkOtlpConfig, type TraceSinkSnapshot, type TraceSummarySection, type TraceToolCallSection, type TraceToolResultSection, type TracingConfig, type TracingMode, type UnifiedMessage, VertexProvider, type VertexProviderConfig, agentVerdictRule, buildSystemPrompt, captureSnapshot, codePresenceRule, cognipeerSink, countApproxTokens, countMessagesTokens, createAgent, createAgentNode, createCodeGuardrail, createContextSummarizeNode, createContextTools, createGetToolResponseTool, createGuardrail, createJsonGuardrail, createManageTodoTool, createProvider, createRegexGuardrail, createResolverNode, createSmartAgent, createTool, createToolLimitFinalizeNode, createToolsNode, customCallbackRule, customSink, emptyUsage, evaluateGuardrails, fileSink, formatZodError, fromLangchainModel, fromLangchainTools, fromNativeProvider, generateSpanId, generateTraceId, getModelCapabilities, getNestedValue, getResolvedSmartConfig, hasToolResponseRecoveryReference, httpSink, isSmartModel, jsonSchemaRule, normalizeSmartAgentOptions, otlpSink, readMemoryFacts, regexRule, resolveMemoryStore, resolveStrategy, resolveToolApprovalState, restoreSnapshot, runSmartAgentEvalHarness, startStreamingSession, traceSessionToOtlp, withTools, writeSummaryFactsToMemory };
|
|
1978
|
+
export { type AIMessage, type AgentInstance, type AgentInvokeResult, type AgentLimits, type AgentOptions, type AgentRuleOptions, type AgentRuntimeConfig, type AgentSnapshot, type AgentSnapshotMetadata, type AgentState, AnthropicProvider, type AnthropicProviderConfig, AzureProvider, type AzureProviderConfig, type BaseChatMessage, type BaseChatMessagePart, type BaseChatModel, type BaseMessage, BaseProvider, BedrockProvider, type BedrockProviderConfig, type BuiltInRuntimeProfile, type CancellationTokenLike, type CancelledEvent, type ChatCompletionChunk, type ChatCompletionRequest, type ChatCompletionResponse, type ChildContextPolicy, type CodeDetectionRuleOptions, type CodeGuardrailOptions, type ContextPolicy, type ContextToolsStateRef, type ConversationGuardrail, type CustomRuleCallback, type CustomRuleOptions, DEFAULT_PROFILE_CONFIGS, type DelegationMode, type EvalCase, type EvalCaseResult, type EvalFamily, type EvalHarnessMetrics, type EvalHarnessParams, type EvalHarnessResult, type EvalProfileDescriptor, type EvalProfileTarget, type FinalAnswerEvent, type FinishReason, type GuardrailContext, type GuardrailDisposition, type GuardrailEvent, type GuardrailIncident, type GuardrailOutcome, GuardrailPhase, type GuardrailRule, type HandoffDescriptor, type HandoffEvent, InMemoryMemoryStore, type InvokeConfig, type JsonGuardrailOptions, type JsonSchemaRuleOptions, type MemoryFact, type MemoryProviderKind, type MemoryReadPolicy, type MemoryScope, type MemoryStore, type MemoryWritePolicy, type Message, type MetadataEvent, type ModelCapabilities, NativeJsonSchemaStrategy, type NativeModelOptions, type NativeReasoningConfig, OpenAICompatibleProvider, type OpenAICompatibleProviderConfig, OpenAIProvider, type OpenAIProviderConfig, type PendingToolApproval, type PlanEvent, type PlanStepRecord, type PlanningMode, type ProfileConfig, type ProgressEvent, type ProgressUpdate, type ProviderConfig, ProviderError, type ToolCall as ProviderToolCall, type ToolDefinition as ProviderToolDefinition, type ProviderType, type ReasoningConfig, type ReasoningLevel, type ReflectionCadence, type ReflectionConfig, type ReflectionEvent, type ReflectionRecord, type RegexGuardrailOptions, type RegexRuleOptions, type ReplanPolicy, type ResolvedSmartAgentConfig, type ResolvedTraceConfig, type ResolvedTraceSink, type RestoreSnapshotOptions, type RuntimeProfile, type SerializableSmartState, type SmartAgentBudgetConfig, type SmartAgentContextConfig, type SmartAgentCustomProfileConfig, type SmartAgentDelegationConfig, type SmartAgentEvent, type SmartAgentInstance, type SmartAgentLimits, type SmartAgentMemoryConfig, type SmartAgentOptions, type SmartAgentPlanningConfig, type SmartAgentSummarizationConfig, type SmartAgentToolResponseConfig, type SmartAgentTracingConfig, type SmartModel, type SmartState, type SmartToolFn, type SnapshotOptions, type SnapshotRuntimeHint, type StreamChunk, type StreamEvent, type StructuredOutputError, type StructuredOutputFieldError, StructuredOutputManager, type StructuredOutputManagerConfig, type StructuredOutputResult, type StructuredOutputStrategy, type StructuredSummary, type SummarizationEvent, type SummarizationMode, type SummaryFactItem, type SummaryIntegrityCheck, type TokenCounter, type TokenUsage, type ToolApprovalEvent, type ToolApprovalResolution, type ToolApprovalStatus, ToolBasedStrategy, type ToolCachePolicy, type ToolCallEvent, type ToolInterface, type ToolResponseClassification, type ToolResponseRetentionPolicy, type ToolRetryPolicy, type TraceDataSection, type TraceErrorRecord, type TraceEventRecord, type TraceMessageSection, type TraceMetadataSection, type TraceSessionConfigSnapshot, type TraceSessionFile, type TraceSessionStatus, type TraceSessionSummary, type TraceSinkCognipeerConfig, type TraceSinkConfig, type TraceSinkCustomConfig, type TraceSinkFileConfig, type TraceSinkHttpConfig, type TraceSinkOtlpConfig, type TraceSinkSnapshot, type TraceSummarySection, type TraceToolCallSection, type TraceToolResultSection, type TracingConfig, type TracingMode, type UnifiedMessage, VertexProvider, type VertexProviderConfig, agentVerdictRule, buildSystemPrompt, captureSnapshot, codePresenceRule, cognipeerSink, countApproxTokens, countMessagesTokens, createAgent, createAgentNode, createCodeGuardrail, createContextSummarizeNode, createContextTools, createGetToolResponseTool, createGuardrail, createJsonGuardrail, createManageTodoTool, createProvider, createRegexGuardrail, createResolverNode, createSmartAgent, createTool, createToolLimitFinalizeNode, createToolsNode, customCallbackRule, customSink, defaultTokenCounter, emptyUsage, evaluateGuardrails, fileSink, formatZodError, fromLangchainModel, fromLangchainTools, fromNativeProvider, generateSpanId, generateTraceId, getModelCapabilities, getNestedValue, getResolvedSmartConfig, getTokenCounter, hasToolResponseRecoveryReference, httpSink, isSmartModel, jsonSchemaRule, normalizeSmartAgentOptions, otlpSink, readMemoryFacts, regexRule, resolveMemoryStore, resolveStrategy, resolveToolApprovalState, restoreSnapshot, runSmartAgentEvalHarness, setTokenCounter, startStreamingSession, traceSessionToOtlp, withTools, writeSummaryFactsToMemory };
|
package/dist/index.d.ts
CHANGED
|
@@ -206,6 +206,24 @@ type AgentLimits = {
|
|
|
206
206
|
maxToolCalls?: number;
|
|
207
207
|
maxParallelTools?: number;
|
|
208
208
|
maxContextTokens?: number;
|
|
209
|
+
/**
|
|
210
|
+
* Cap on cumulative model output tokens across the whole invoke. Once
|
|
211
|
+
* exceeded the loop terminates after the current iteration with a
|
|
212
|
+
* `metadata` event explaining the reason and emits `finalAnswer` so callers
|
|
213
|
+
* can still recover the partial result.
|
|
214
|
+
*/
|
|
215
|
+
maxTotalOutputTokens?: number;
|
|
216
|
+
/**
|
|
217
|
+
* Cap on cumulative cost in USD. Requires `costEstimator` on the agent
|
|
218
|
+
* options to be a no-op-free check; otherwise this limit is ignored.
|
|
219
|
+
*/
|
|
220
|
+
maxCostUsd?: number;
|
|
221
|
+
/**
|
|
222
|
+
* Cap on total wall-clock time for the invoke in milliseconds. Identical
|
|
223
|
+
* semantics to `InvokeConfig.timeoutMs` but lives on the agent definition
|
|
224
|
+
* so server-side defaults can be enforced without per-call wiring.
|
|
225
|
+
*/
|
|
226
|
+
maxWallClockMs?: number;
|
|
209
227
|
};
|
|
210
228
|
type SmartAgentLimits = AgentLimits;
|
|
211
229
|
type TraceSinkFileConfig = {
|
|
@@ -262,6 +280,25 @@ type AgentOptions = {
|
|
|
262
280
|
* When omitted or `enabled=false` the agent behaves exactly as before.
|
|
263
281
|
*/
|
|
264
282
|
reasoning?: ReasoningConfig;
|
|
283
|
+
/**
|
|
284
|
+
* Optional drop-in token counter. When provided, all internal token
|
|
285
|
+
* estimates (summarization trigger, hard caps, context budget) use this
|
|
286
|
+
* function instead of the built-in character heuristic. Recommended:
|
|
287
|
+
* tiktoken / @anthropic-ai/tokenizer for production accuracy.
|
|
288
|
+
*/
|
|
289
|
+
tokenCounter?: (text: string) => number;
|
|
290
|
+
/**
|
|
291
|
+
* Pluggable cost estimator: returns USD cost for a single model call's
|
|
292
|
+
* usage. Used by the `maxCostUsd` budget limit. When omitted the SDK has
|
|
293
|
+
* no built-in pricing table and the cost limit is a no-op.
|
|
294
|
+
*/
|
|
295
|
+
costEstimator?: (args: {
|
|
296
|
+
modelName?: string;
|
|
297
|
+
inputTokens: number;
|
|
298
|
+
outputTokens: number;
|
|
299
|
+
cachedInputTokens?: number;
|
|
300
|
+
reasoningTokens?: number;
|
|
301
|
+
}) => number;
|
|
265
302
|
};
|
|
266
303
|
type ReasoningLevel = "low" | "medium" | "high";
|
|
267
304
|
type ReflectionCadence = "off" | "every_turn" | "after_tool" | "on_branch";
|
|
@@ -282,6 +319,18 @@ type ReflectionConfig = {
|
|
|
282
319
|
promptTemplate?: string;
|
|
283
320
|
/** When true emits `reflection` SmartAgent events. Default true. */
|
|
284
321
|
emitEvents?: boolean;
|
|
322
|
+
/**
|
|
323
|
+
* Hard cap on the number of reflection calls within a single invoke. Once
|
|
324
|
+
* the cap is hit subsequent qualifying turns no longer trigger reflection.
|
|
325
|
+
* Default: unlimited.
|
|
326
|
+
*/
|
|
327
|
+
maxPerRun?: number;
|
|
328
|
+
/**
|
|
329
|
+
* Minimum number of tool-bearing turns between reflections. Defaults to 1
|
|
330
|
+
* (reflect on every qualifying turn). Set to 2 to reflect every other tool
|
|
331
|
+
* turn, etc. Independent of `cadence`.
|
|
332
|
+
*/
|
|
333
|
+
everyNTurns?: number;
|
|
285
334
|
};
|
|
286
335
|
type NativeReasoningConfig = {
|
|
287
336
|
effort?: "minimal" | "low" | "medium" | "high";
|
|
@@ -418,7 +467,7 @@ type SmartAgentToolResponseConfig = {
|
|
|
418
467
|
/**
|
|
419
468
|
* Retention policy applied to all non-critical tool responses by the summarizer
|
|
420
469
|
* when it fires (context limit reached). Has no effect at execution time.
|
|
421
|
-
|
|
470
|
+
* Defaults to context.toolResponsePolicy, or the active runtime profile default.
|
|
422
471
|
*/
|
|
423
472
|
defaultPolicy?: ToolResponseRetentionPolicy;
|
|
424
473
|
/**
|
|
@@ -485,6 +534,10 @@ type SmartAgentOptions = {
|
|
|
485
534
|
* Unified reasoning configuration. Same shape as on `AgentOptions`. See `ReasoningConfig`.
|
|
486
535
|
*/
|
|
487
536
|
reasoning?: ReasoningConfig;
|
|
537
|
+
/** See AgentOptions.tokenCounter. */
|
|
538
|
+
tokenCounter?: (text: string) => number;
|
|
539
|
+
/** See AgentOptions.costEstimator. */
|
|
540
|
+
costEstimator?: AgentOptions["costEstimator"];
|
|
488
541
|
};
|
|
489
542
|
type AgentRuntimeConfig = {
|
|
490
543
|
name?: string;
|
|
@@ -1098,7 +1151,29 @@ type AgentInstance<TOutput = unknown> = {
|
|
|
1098
1151
|
type SmartAgentInstance<TOutput = unknown> = AgentInstance<TOutput>;
|
|
1099
1152
|
|
|
1100
1153
|
type SmartToolFn = (args: any) => Promise<any> | any;
|
|
1101
|
-
|
|
1154
|
+
type ToolCachePolicy = {
|
|
1155
|
+
/** Cache scope. "run" persists for the current invoke only. */
|
|
1156
|
+
scope?: "run";
|
|
1157
|
+
/** Override the cache key (default: stable JSON of args). */
|
|
1158
|
+
keyFn?: (args: any) => string;
|
|
1159
|
+
/** Time-to-live for the cached value, in ms. Default: full invoke. */
|
|
1160
|
+
ttlMs?: number;
|
|
1161
|
+
};
|
|
1162
|
+
type ToolRetryPolicy = {
|
|
1163
|
+
/** Max retry attempts after the initial failure. Default: 0. */
|
|
1164
|
+
maxRetries?: number;
|
|
1165
|
+
/** Initial backoff in ms (doubled on each retry). Default: 250. */
|
|
1166
|
+
backoffMs?: number;
|
|
1167
|
+
/** Decide whether an error is worth retrying. Default: every error. */
|
|
1168
|
+
shouldRetry?: (err: unknown, attempt: number) => boolean;
|
|
1169
|
+
/**
|
|
1170
|
+
* Open a circuit-breaker after this many consecutive failures across the
|
|
1171
|
+
* invoke; once tripped the tool short-circuits with the breaker error
|
|
1172
|
+
* until the loop ends. Default: never trip.
|
|
1173
|
+
*/
|
|
1174
|
+
circuitBreakerThreshold?: number;
|
|
1175
|
+
};
|
|
1176
|
+
declare function createTool({ name, description, schema, func, needsApproval, approvalPrompt, approvalDefaults, maxExecutionsPerRun, cache, retry, }: {
|
|
1102
1177
|
name: string;
|
|
1103
1178
|
description?: string;
|
|
1104
1179
|
schema: ZodSchema;
|
|
@@ -1107,6 +1182,10 @@ declare function createTool({ name, description, schema, func, needsApproval, ap
|
|
|
1107
1182
|
approvalPrompt?: string;
|
|
1108
1183
|
approvalDefaults?: any;
|
|
1109
1184
|
maxExecutionsPerRun?: number | null;
|
|
1185
|
+
/** When set, identical args within the same invoke short-circuit to the cached result. */
|
|
1186
|
+
cache?: boolean | ToolCachePolicy;
|
|
1187
|
+
/** Per-tool retry + circuit-breaker policy. */
|
|
1188
|
+
retry?: ToolRetryPolicy;
|
|
1110
1189
|
}): ToolInterface;
|
|
1111
1190
|
|
|
1112
1191
|
declare function buildSystemPrompt(extra?: string, planning?: boolean | PlanningMode, name?: string, todoListPrompt?: string): string;
|
|
@@ -1137,15 +1216,30 @@ declare function createToolLimitFinalizeNode(_opts: SmartAgentOptions): (state:
|
|
|
1137
1216
|
*/
|
|
1138
1217
|
declare function createContextSummarizeNode(opts: SmartAgentOptions): (state: SmartState) => Promise<Partial<SmartState>>;
|
|
1139
1218
|
|
|
1219
|
+
/**
|
|
1220
|
+
* Token counter contract used across the SDK. The default is a
|
|
1221
|
+
* character-based heuristic; users can swap in a real tokenizer (tiktoken,
|
|
1222
|
+
* @anthropic-ai/tokenizer, …) via SmartAgentOptions.tokenCounter.
|
|
1223
|
+
*/
|
|
1224
|
+
type TokenCounter = (text: string) => number;
|
|
1140
1225
|
/**
|
|
1141
1226
|
* Estimates token count from text using a character-based heuristic.
|
|
1142
1227
|
*
|
|
1143
|
-
*
|
|
1228
|
+
* Approximation:
|
|
1144
1229
|
* - For Latin/ASCII text: ~4 characters per token (GPT-family models)
|
|
1145
1230
|
* - For CJK/Unicode text: ~1.5 characters per token
|
|
1146
1231
|
*
|
|
1147
|
-
* For production accuracy,
|
|
1232
|
+
* For production accuracy, pass a `tokenCounter` option backed by tiktoken.
|
|
1233
|
+
*/
|
|
1234
|
+
declare function defaultTokenCounter(text: string): number;
|
|
1235
|
+
/**
|
|
1236
|
+
* Installs a custom token counter used by every callable in this module
|
|
1237
|
+
* (countApproxTokens, countMessagesTokens). Pass `undefined` or
|
|
1238
|
+
* `defaultTokenCounter` to restore the heuristic.
|
|
1148
1239
|
*/
|
|
1240
|
+
declare function setTokenCounter(counter?: TokenCounter | null): void;
|
|
1241
|
+
declare function getTokenCounter(): TokenCounter;
|
|
1242
|
+
/** Backwards-compatible alias that delegates to the active counter. */
|
|
1149
1243
|
declare function countApproxTokens(text: string): number;
|
|
1150
1244
|
/**
|
|
1151
1245
|
* Estimates the total token count for an array of messages.
|
|
@@ -1624,6 +1718,16 @@ type ChatCompletionChunk = {
|
|
|
1624
1718
|
usage?: TokenUsage;
|
|
1625
1719
|
finishReason?: FinishReason;
|
|
1626
1720
|
};
|
|
1721
|
+
type ProviderRetryConfig = {
|
|
1722
|
+
/** Maximum retries on 429/5xx (default 3). */
|
|
1723
|
+
maxRetries?: number;
|
|
1724
|
+
/** Initial delay between retries in ms (default 500, doubled each attempt). */
|
|
1725
|
+
baseDelayMs?: number;
|
|
1726
|
+
/** Hard cap on a single retry delay in ms (default 8000). */
|
|
1727
|
+
maxDelayMs?: number;
|
|
1728
|
+
/** Custom predicate to opt in/out of a specific retry. */
|
|
1729
|
+
shouldRetry?: (error: any, attempt: number) => boolean;
|
|
1730
|
+
};
|
|
1627
1731
|
type OpenAIProviderConfig = {
|
|
1628
1732
|
provider: "openai";
|
|
1629
1733
|
apiKey: string;
|
|
@@ -1631,6 +1735,7 @@ type OpenAIProviderConfig = {
|
|
|
1631
1735
|
organization?: string;
|
|
1632
1736
|
defaultModel?: string;
|
|
1633
1737
|
defaultHeaders?: Record<string, string>;
|
|
1738
|
+
retry?: ProviderRetryConfig;
|
|
1634
1739
|
};
|
|
1635
1740
|
type AnthropicProviderConfig = {
|
|
1636
1741
|
provider: "anthropic";
|
|
@@ -1639,6 +1744,15 @@ type AnthropicProviderConfig = {
|
|
|
1639
1744
|
defaultModel?: string;
|
|
1640
1745
|
defaultHeaders?: Record<string, string>;
|
|
1641
1746
|
anthropicVersion?: string;
|
|
1747
|
+
retry?: ProviderRetryConfig;
|
|
1748
|
+
/**
|
|
1749
|
+
* Prompt caching configuration. When enabled, places cache_control:
|
|
1750
|
+
* ephemeral breakpoints on the system prompt and the final tool definition,
|
|
1751
|
+
* which is the recommended Anthropic recipe for static system + tools.
|
|
1752
|
+
*/
|
|
1753
|
+
prompt_caching?: {
|
|
1754
|
+
enabled: boolean;
|
|
1755
|
+
};
|
|
1642
1756
|
};
|
|
1643
1757
|
type AzureProviderConfig = {
|
|
1644
1758
|
provider: "azure";
|
|
@@ -1664,6 +1778,15 @@ type BedrockProviderConfig = {
|
|
|
1664
1778
|
sessionToken?: string;
|
|
1665
1779
|
defaultModel?: string;
|
|
1666
1780
|
defaultHeaders?: Record<string, string>;
|
|
1781
|
+
retry?: ProviderRetryConfig;
|
|
1782
|
+
/**
|
|
1783
|
+
* Insert Bedrock Converse `cachePoint` blocks at the end of the system
|
|
1784
|
+
* prompt and tools list. Only supported by models that implement Converse
|
|
1785
|
+
* prompt caching (most Anthropic Claude variants on Bedrock).
|
|
1786
|
+
*/
|
|
1787
|
+
prompt_caching?: {
|
|
1788
|
+
enabled: boolean;
|
|
1789
|
+
};
|
|
1667
1790
|
};
|
|
1668
1791
|
type VertexProviderConfig = {
|
|
1669
1792
|
provider: "vertex";
|
|
@@ -1683,12 +1806,32 @@ declare class ProviderError extends Error {
|
|
|
1683
1806
|
constructor(message: string, provider: string, statusCode?: number | undefined, responseBody?: any | undefined);
|
|
1684
1807
|
}
|
|
1685
1808
|
|
|
1809
|
+
type ProviderRetryPolicy = {
|
|
1810
|
+
/** Maximum number of retries on 429/5xx responses. Default: 3. */
|
|
1811
|
+
maxRetries?: number;
|
|
1812
|
+
/** Initial backoff in ms (doubled on each retry). Default: 500. */
|
|
1813
|
+
baseDelayMs?: number;
|
|
1814
|
+
/** Hard cap on individual delay between retries. Default: 8000. */
|
|
1815
|
+
maxDelayMs?: number;
|
|
1816
|
+
/**
|
|
1817
|
+
* Custom predicate to decide whether to retry. By default we retry 429
|
|
1818
|
+
* and 5xx responses; pass a function to broaden/narrow that set.
|
|
1819
|
+
*/
|
|
1820
|
+
shouldRetry?: (error: any, attempt: number) => boolean;
|
|
1821
|
+
};
|
|
1686
1822
|
declare abstract class BaseProvider {
|
|
1687
1823
|
abstract readonly providerName: ProviderType;
|
|
1824
|
+
protected retryPolicy: ProviderRetryPolicy;
|
|
1688
1825
|
/** Non-streaming completion */
|
|
1689
1826
|
abstract complete(request: ChatCompletionRequest): Promise<ChatCompletionResponse>;
|
|
1690
1827
|
/** Streaming completion – yields incremental chunks */
|
|
1691
1828
|
abstract completeStream(request: ChatCompletionRequest): AsyncGenerator<ChatCompletionChunk, void, unknown>;
|
|
1829
|
+
/**
|
|
1830
|
+
* Helper concrete providers can wrap their fetch with. Retries 429/5xx
|
|
1831
|
+
* with exponential backoff and respects Retry-After if the response
|
|
1832
|
+
* carries one.
|
|
1833
|
+
*/
|
|
1834
|
+
protected doFetchWithRetry(execute: () => Promise<Response>): Promise<Response>;
|
|
1692
1835
|
}
|
|
1693
1836
|
|
|
1694
1837
|
declare class OpenAIProvider extends BaseProvider {
|
|
@@ -1715,6 +1858,7 @@ declare class AnthropicProvider extends BaseProvider {
|
|
|
1715
1858
|
private readonly defaultModel;
|
|
1716
1859
|
private readonly defaultHeaders;
|
|
1717
1860
|
private readonly anthropicVersion;
|
|
1861
|
+
private readonly promptCachingEnabled;
|
|
1718
1862
|
constructor(config: AnthropicProviderConfig);
|
|
1719
1863
|
complete(request: ChatCompletionRequest): Promise<ChatCompletionResponse>;
|
|
1720
1864
|
completeStream(request: ChatCompletionRequest): AsyncGenerator<ChatCompletionChunk, void, unknown>;
|
|
@@ -1747,6 +1891,7 @@ declare class BedrockProvider extends BaseProvider {
|
|
|
1747
1891
|
private readonly credentials;
|
|
1748
1892
|
private readonly defaultModel;
|
|
1749
1893
|
private readonly defaultHeaders;
|
|
1894
|
+
private readonly promptCachingEnabled;
|
|
1750
1895
|
constructor(config: BedrockProviderConfig);
|
|
1751
1896
|
complete(request: ChatCompletionRequest): Promise<ChatCompletionResponse>;
|
|
1752
1897
|
completeStream(request: ChatCompletionRequest): AsyncGenerator<ChatCompletionChunk, void, unknown>;
|
|
@@ -1830,4 +1975,4 @@ declare function fromNativeProvider(provider: BaseProvider, options?: NativeMode
|
|
|
1830
1975
|
*/
|
|
1831
1976
|
declare function createProvider(config: ProviderConfig): BaseProvider;
|
|
1832
1977
|
|
|
1833
|
-
export { type AIMessage, type AgentInstance, type AgentInvokeResult, type AgentLimits, type AgentOptions, type AgentRuleOptions, type AgentRuntimeConfig, type AgentSnapshot, type AgentSnapshotMetadata, type AgentState, AnthropicProvider, type AnthropicProviderConfig, AzureProvider, type AzureProviderConfig, type BaseChatMessage, type BaseChatMessagePart, type BaseChatModel, type BaseMessage, BaseProvider, BedrockProvider, type BedrockProviderConfig, type BuiltInRuntimeProfile, type CancellationTokenLike, type CancelledEvent, type ChatCompletionChunk, type ChatCompletionRequest, type ChatCompletionResponse, type ChildContextPolicy, type CodeDetectionRuleOptions, type CodeGuardrailOptions, type ContextPolicy, type ContextToolsStateRef, type ConversationGuardrail, type CustomRuleCallback, type CustomRuleOptions, DEFAULT_PROFILE_CONFIGS, type DelegationMode, type EvalCase, type EvalCaseResult, type EvalFamily, type EvalHarnessMetrics, type EvalHarnessParams, type EvalHarnessResult, type EvalProfileDescriptor, type EvalProfileTarget, type FinalAnswerEvent, type FinishReason, type GuardrailContext, type GuardrailDisposition, type GuardrailEvent, type GuardrailIncident, type GuardrailOutcome, GuardrailPhase, type GuardrailRule, type HandoffDescriptor, type HandoffEvent, InMemoryMemoryStore, type InvokeConfig, type JsonGuardrailOptions, type JsonSchemaRuleOptions, type MemoryFact, type MemoryProviderKind, type MemoryReadPolicy, type MemoryScope, type MemoryStore, type MemoryWritePolicy, type Message, type MetadataEvent, type ModelCapabilities, NativeJsonSchemaStrategy, type NativeModelOptions, type NativeReasoningConfig, OpenAICompatibleProvider, type OpenAICompatibleProviderConfig, OpenAIProvider, type OpenAIProviderConfig, type PendingToolApproval, type PlanEvent, type PlanStepRecord, type PlanningMode, type ProfileConfig, type ProgressEvent, type ProgressUpdate, type ProviderConfig, ProviderError, type ToolCall as ProviderToolCall, type ToolDefinition as ProviderToolDefinition, type ProviderType, type ReasoningConfig, type ReasoningLevel, type ReflectionCadence, type ReflectionConfig, type ReflectionEvent, type ReflectionRecord, type RegexGuardrailOptions, type RegexRuleOptions, type ReplanPolicy, type ResolvedSmartAgentConfig, type ResolvedTraceConfig, type ResolvedTraceSink, type RestoreSnapshotOptions, type RuntimeProfile, type SerializableSmartState, type SmartAgentBudgetConfig, type SmartAgentContextConfig, type SmartAgentCustomProfileConfig, type SmartAgentDelegationConfig, type SmartAgentEvent, type SmartAgentInstance, type SmartAgentLimits, type SmartAgentMemoryConfig, type SmartAgentOptions, type SmartAgentPlanningConfig, type SmartAgentSummarizationConfig, type SmartAgentToolResponseConfig, type SmartAgentTracingConfig, type SmartModel, type SmartState, type SmartToolFn, type SnapshotOptions, type SnapshotRuntimeHint, type StreamChunk, type StreamEvent, type StructuredOutputError, type StructuredOutputFieldError, StructuredOutputManager, type StructuredOutputManagerConfig, type StructuredOutputResult, type StructuredOutputStrategy, type StructuredSummary, type SummarizationEvent, type SummarizationMode, type SummaryFactItem, type SummaryIntegrityCheck, type TokenUsage, type ToolApprovalEvent, type ToolApprovalResolution, type ToolApprovalStatus, ToolBasedStrategy, type ToolCallEvent, type ToolInterface, type ToolResponseClassification, type ToolResponseRetentionPolicy, type TraceDataSection, type TraceErrorRecord, type TraceEventRecord, type TraceMessageSection, type TraceMetadataSection, type TraceSessionConfigSnapshot, type TraceSessionFile, type TraceSessionStatus, type TraceSessionSummary, type TraceSinkCognipeerConfig, type TraceSinkConfig, type TraceSinkCustomConfig, type TraceSinkFileConfig, type TraceSinkHttpConfig, type TraceSinkOtlpConfig, type TraceSinkSnapshot, type TraceSummarySection, type TraceToolCallSection, type TraceToolResultSection, type TracingConfig, type TracingMode, type UnifiedMessage, VertexProvider, type VertexProviderConfig, agentVerdictRule, buildSystemPrompt, captureSnapshot, codePresenceRule, cognipeerSink, countApproxTokens, countMessagesTokens, createAgent, createAgentNode, createCodeGuardrail, createContextSummarizeNode, createContextTools, createGetToolResponseTool, createGuardrail, createJsonGuardrail, createManageTodoTool, createProvider, createRegexGuardrail, createResolverNode, createSmartAgent, createTool, createToolLimitFinalizeNode, createToolsNode, customCallbackRule, customSink, emptyUsage, evaluateGuardrails, fileSink, formatZodError, fromLangchainModel, fromLangchainTools, fromNativeProvider, generateSpanId, generateTraceId, getModelCapabilities, getNestedValue, getResolvedSmartConfig, hasToolResponseRecoveryReference, httpSink, isSmartModel, jsonSchemaRule, normalizeSmartAgentOptions, otlpSink, readMemoryFacts, regexRule, resolveMemoryStore, resolveStrategy, resolveToolApprovalState, restoreSnapshot, runSmartAgentEvalHarness, startStreamingSession, traceSessionToOtlp, withTools, writeSummaryFactsToMemory };
|
|
1978
|
+
export { type AIMessage, type AgentInstance, type AgentInvokeResult, type AgentLimits, type AgentOptions, type AgentRuleOptions, type AgentRuntimeConfig, type AgentSnapshot, type AgentSnapshotMetadata, type AgentState, AnthropicProvider, type AnthropicProviderConfig, AzureProvider, type AzureProviderConfig, type BaseChatMessage, type BaseChatMessagePart, type BaseChatModel, type BaseMessage, BaseProvider, BedrockProvider, type BedrockProviderConfig, type BuiltInRuntimeProfile, type CancellationTokenLike, type CancelledEvent, type ChatCompletionChunk, type ChatCompletionRequest, type ChatCompletionResponse, type ChildContextPolicy, type CodeDetectionRuleOptions, type CodeGuardrailOptions, type ContextPolicy, type ContextToolsStateRef, type ConversationGuardrail, type CustomRuleCallback, type CustomRuleOptions, DEFAULT_PROFILE_CONFIGS, type DelegationMode, type EvalCase, type EvalCaseResult, type EvalFamily, type EvalHarnessMetrics, type EvalHarnessParams, type EvalHarnessResult, type EvalProfileDescriptor, type EvalProfileTarget, type FinalAnswerEvent, type FinishReason, type GuardrailContext, type GuardrailDisposition, type GuardrailEvent, type GuardrailIncident, type GuardrailOutcome, GuardrailPhase, type GuardrailRule, type HandoffDescriptor, type HandoffEvent, InMemoryMemoryStore, type InvokeConfig, type JsonGuardrailOptions, type JsonSchemaRuleOptions, type MemoryFact, type MemoryProviderKind, type MemoryReadPolicy, type MemoryScope, type MemoryStore, type MemoryWritePolicy, type Message, type MetadataEvent, type ModelCapabilities, NativeJsonSchemaStrategy, type NativeModelOptions, type NativeReasoningConfig, OpenAICompatibleProvider, type OpenAICompatibleProviderConfig, OpenAIProvider, type OpenAIProviderConfig, type PendingToolApproval, type PlanEvent, type PlanStepRecord, type PlanningMode, type ProfileConfig, type ProgressEvent, type ProgressUpdate, type ProviderConfig, ProviderError, type ToolCall as ProviderToolCall, type ToolDefinition as ProviderToolDefinition, type ProviderType, type ReasoningConfig, type ReasoningLevel, type ReflectionCadence, type ReflectionConfig, type ReflectionEvent, type ReflectionRecord, type RegexGuardrailOptions, type RegexRuleOptions, type ReplanPolicy, type ResolvedSmartAgentConfig, type ResolvedTraceConfig, type ResolvedTraceSink, type RestoreSnapshotOptions, type RuntimeProfile, type SerializableSmartState, type SmartAgentBudgetConfig, type SmartAgentContextConfig, type SmartAgentCustomProfileConfig, type SmartAgentDelegationConfig, type SmartAgentEvent, type SmartAgentInstance, type SmartAgentLimits, type SmartAgentMemoryConfig, type SmartAgentOptions, type SmartAgentPlanningConfig, type SmartAgentSummarizationConfig, type SmartAgentToolResponseConfig, type SmartAgentTracingConfig, type SmartModel, type SmartState, type SmartToolFn, type SnapshotOptions, type SnapshotRuntimeHint, type StreamChunk, type StreamEvent, type StructuredOutputError, type StructuredOutputFieldError, StructuredOutputManager, type StructuredOutputManagerConfig, type StructuredOutputResult, type StructuredOutputStrategy, type StructuredSummary, type SummarizationEvent, type SummarizationMode, type SummaryFactItem, type SummaryIntegrityCheck, type TokenCounter, type TokenUsage, type ToolApprovalEvent, type ToolApprovalResolution, type ToolApprovalStatus, ToolBasedStrategy, type ToolCachePolicy, type ToolCallEvent, type ToolInterface, type ToolResponseClassification, type ToolResponseRetentionPolicy, type ToolRetryPolicy, type TraceDataSection, type TraceErrorRecord, type TraceEventRecord, type TraceMessageSection, type TraceMetadataSection, type TraceSessionConfigSnapshot, type TraceSessionFile, type TraceSessionStatus, type TraceSessionSummary, type TraceSinkCognipeerConfig, type TraceSinkConfig, type TraceSinkCustomConfig, type TraceSinkFileConfig, type TraceSinkHttpConfig, type TraceSinkOtlpConfig, type TraceSinkSnapshot, type TraceSummarySection, type TraceToolCallSection, type TraceToolResultSection, type TracingConfig, type TracingMode, type UnifiedMessage, VertexProvider, type VertexProviderConfig, agentVerdictRule, buildSystemPrompt, captureSnapshot, codePresenceRule, cognipeerSink, countApproxTokens, countMessagesTokens, createAgent, createAgentNode, createCodeGuardrail, createContextSummarizeNode, createContextTools, createGetToolResponseTool, createGuardrail, createJsonGuardrail, createManageTodoTool, createProvider, createRegexGuardrail, createResolverNode, createSmartAgent, createTool, createToolLimitFinalizeNode, createToolsNode, customCallbackRule, customSink, defaultTokenCounter, emptyUsage, evaluateGuardrails, fileSink, formatZodError, fromLangchainModel, fromLangchainTools, fromNativeProvider, generateSpanId, generateTraceId, getModelCapabilities, getNestedValue, getResolvedSmartConfig, getTokenCounter, hasToolResponseRecoveryReference, httpSink, isSmartModel, jsonSchemaRule, normalizeSmartAgentOptions, otlpSink, readMemoryFacts, regexRule, resolveMemoryStore, resolveStrategy, resolveToolApprovalState, restoreSnapshot, runSmartAgentEvalHarness, setTokenCounter, startStreamingSession, traceSessionToOtlp, withTools, writeSummaryFactsToMemory };
|