@chimp-labs/keel-ai-kit 0.0.0-stage → 0.1.0

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/CHANGELOG.md ADDED
@@ -0,0 +1,7 @@
1
+ # @chimp-labs/keel-ai-kit
2
+
3
+ ## 0.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Initial release of `@chimp-labs/keel-ai-kit`: AI `Agent`, `LLM` provider adapters, and isolated `Sandbox` primitives built on `@chimp-labs/keel`.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ChimpLabs
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,34 @@
1
- # Temporary Holding Version
1
+ # `@chimp-labs/keel-ai-kit`
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Tree-shakeable AI Agent, LLM provider, and isolated Sandbox primitives built on [`@chimp-labs/keel`](../keel)'s open plugin protocol (`KeelBindSym`, `KeelDefaultLayerSym`, `KeelEnsureSym`, `KeelInfraSym`, `KeelErrorMetaSym`):
4
+
5
+ - `@chimp-labs/keel-ai-kit/agent` — Durable tool-calling AI agents with typed tools (`agentTool`, `serviceTool`, `sandboxTool`, `searchTool`), IAM enforcement, structured output, and human-in-the-loop `Signal` approvals
6
+ - `@chimp-labs/keel-ai-kit/llm` & `@chimp-labs/keel-ai-kit/llm/providers` — Swappable `LlmProvider` with OpenAI, Anthropic, Google Gemini, OpenRouter, LiteLLM, and fallback routing
7
+ - `@chimp-labs/keel-ai-kit/sandbox` & `@chimp-labs/keel-ai-kit/sandbox/providers` — Isolated code execution sandboxes with capability validation, Bucket sync, snapshots, and Docker / E2B / Daytona / Modal / Vercel / Cloudflare providers
8
+
9
+ ## Usage
10
+
11
+ ```ts
12
+ import { createKeel, k } from "@chimp-labs/keel/sdk"
13
+ import { agent, agentTool } from "@chimp-labs/keel-ai-kit/agent"
14
+ import { LlmOpenAILive } from "@chimp-labs/keel-ai-kit/llm/providers"
15
+
16
+ const LookupTool = agentTool({
17
+ name: "lookupOrder",
18
+ description: "Look up an order by ID",
19
+ input: k.object({ orderId: k.string() }),
20
+ execute: ({ orderId }) => ({ orderId, status: "shipped" }),
21
+ })
22
+
23
+ const SupportAgent = agent("support", {
24
+ model: "gpt-4o",
25
+ instructions: "Help customers with their orders.",
26
+ tools: [LookupTool],
27
+ })
28
+
29
+ const keel = await createKeel({
30
+ resources: { support: SupportAgent },
31
+ layers: [LlmOpenAILive({ apiKey: process.env.OPENAI_API_KEY! })],
32
+ ensureAll: true,
33
+ })
34
+ ```
@@ -0,0 +1,365 @@
1
+ import { Cause, Duration, Effect, Schema } from "effect";
2
+ import { type ForbiddenError, type IamAuthRule, type IamDef, type IamStoreError, KeelBindSym, KeelDefaultLayerSym, KeelEnsureSym, type KeelErrorClassification, KeelErrorMetaSym, KeelInfraSym, KeelKindSym, KeelMetaSym, type KeelResource, RelationalStore, SearchEngine, type SearchIndexDef, type ServiceDescriptor, type ServiceOperationsMap, type UnauthorizedError, VectorSearch, WorkflowStore, type WorkflowStoreError } from "@chimp-labs/keel";
3
+ import { type InferSchema, type SchemaLike, type SdkCallOptions, type SdkRunner } from "@chimp-labs/keel/sdk";
4
+ import { type LlmError, type LlmMessage, LlmProvider, type LlmRateLimitError } from "./llm.js";
5
+ import { type SandboxDef, SandboxRuntime } from "./sandbox.js";
6
+ declare const AgentError_base: Schema.Class<AgentError, Schema.TaggedStruct<"AgentError", {
7
+ readonly agent: Schema.String;
8
+ readonly runId: Schema.String;
9
+ readonly cause: Schema.Unknown;
10
+ }>, Cause.YieldableError>;
11
+ export declare class AgentError extends AgentError_base {
12
+ static readonly [KeelErrorMetaSym]: KeelErrorClassification;
13
+ }
14
+ declare const AgentNotFoundError_base: Schema.Class<AgentNotFoundError, Schema.TaggedStruct<"AgentNotFoundError", {
15
+ readonly agent: Schema.String;
16
+ readonly runId: Schema.String;
17
+ }>, Cause.YieldableError>;
18
+ export declare class AgentNotFoundError extends AgentNotFoundError_base {
19
+ static readonly [KeelErrorMetaSym]: KeelErrorClassification;
20
+ }
21
+ declare const AgentMaxStepsError_base: Schema.Class<AgentMaxStepsError, Schema.TaggedStruct<"AgentMaxStepsError", {
22
+ readonly agent: Schema.String;
23
+ readonly runId: Schema.String;
24
+ readonly maxSteps: Schema.Int;
25
+ }>, Cause.YieldableError>;
26
+ export declare class AgentMaxStepsError extends AgentMaxStepsError_base {
27
+ static readonly [KeelErrorMetaSym]: KeelErrorClassification;
28
+ }
29
+ declare const AgentApprovalRejectedError_base: Schema.Class<AgentApprovalRejectedError, Schema.TaggedStruct<"AgentApprovalRejectedError", {
30
+ readonly agent: Schema.String;
31
+ readonly runId: Schema.String;
32
+ readonly tool: Schema.String;
33
+ readonly reason: Schema.optional<Schema.String>;
34
+ }>, Cause.YieldableError>;
35
+ export declare class AgentApprovalRejectedError extends AgentApprovalRejectedError_base {
36
+ static readonly [KeelErrorMetaSym]: KeelErrorClassification;
37
+ }
38
+ declare const AgentApprovalTimeoutError_base: Schema.Class<AgentApprovalTimeoutError, Schema.TaggedStruct<"AgentApprovalTimeoutError", {
39
+ readonly agent: Schema.String;
40
+ readonly runId: Schema.String;
41
+ readonly tool: Schema.String;
42
+ }>, Cause.YieldableError>;
43
+ export declare class AgentApprovalTimeoutError extends AgentApprovalTimeoutError_base {
44
+ static readonly [KeelErrorMetaSym]: KeelErrorClassification;
45
+ }
46
+ declare const AgentToolError_base: Schema.Class<AgentToolError, Schema.TaggedStruct<"AgentToolError", {
47
+ readonly agent: Schema.String;
48
+ readonly runId: Schema.String;
49
+ readonly tool: Schema.String;
50
+ readonly cause: Schema.Unknown;
51
+ }>, Cause.YieldableError>;
52
+ export declare class AgentToolError extends AgentToolError_base {
53
+ static readonly [KeelErrorMetaSym]: KeelErrorClassification;
54
+ }
55
+ export declare const AgentApprovalDecisionSchema: Schema.Struct<{
56
+ readonly callId: Schema.String;
57
+ readonly approved: Schema.Boolean;
58
+ readonly reason: Schema.optional<Schema.String>;
59
+ readonly approverId: Schema.optional<Schema.String>;
60
+ readonly modifiedInput: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
61
+ }>;
62
+ export type AgentApprovalDecision = typeof AgentApprovalDecisionSchema.Type;
63
+ export interface AgentPendingApproval {
64
+ readonly callId: string;
65
+ readonly tool: string;
66
+ readonly input: Record<string, unknown>;
67
+ readonly requestedAt: string;
68
+ }
69
+ export type AgentRunStatus = "running" | "waiting_approval" | "completed" | "failed";
70
+ export interface AgentRunRecord<Out = unknown> {
71
+ readonly runId: string;
72
+ readonly agent: string;
73
+ readonly status: AgentRunStatus;
74
+ readonly messages: ReadonlyArray<LlmMessage>;
75
+ readonly output: Out | undefined;
76
+ readonly pendingApproval: AgentPendingApproval | undefined;
77
+ readonly stepCount: number;
78
+ readonly totalInputTokens: number;
79
+ readonly totalOutputTokens: number;
80
+ readonly error: string | undefined;
81
+ readonly createdAt: string;
82
+ readonly updatedAt: string;
83
+ }
84
+ export declare const schemaToJsonSchema: (schema: Schema.Codec<any, any, never, never>) => Record<string, unknown>;
85
+ export interface AgentToolContext {
86
+ readonly agent: string;
87
+ readonly runId: string;
88
+ readonly callId: string;
89
+ readonly step: number;
90
+ }
91
+ export type AgentToolApprovalRule<In = any> = boolean | ((input: In, ctx: AgentToolContext) => boolean);
92
+ export interface AgentToolDef<Name extends string = string, In = any, Out = any, R = any> {
93
+ readonly name: Name;
94
+ readonly description: string;
95
+ readonly input: Schema.Codec<In, any, never, never>;
96
+ readonly output?: Schema.Codec<Out, any, never, never>;
97
+ /** Optional IAM auth rule checked against `CurrentPrincipal` before execution. */
98
+ readonly auth?: IamAuthRule<string>;
99
+ /** Optional IAM descriptor used when checking `auth` (defaults to the owning Agent's `iam`). */
100
+ readonly iam?: IamDef<any, any, any>;
101
+ /** Require human-in-the-loop approval via `Signal` before running this tool. */
102
+ readonly requiresApproval?: AgentToolApprovalRule<In>;
103
+ /** Underlying Keel resource descriptors referenced by this tool (for `inferKeelInfra`). */
104
+ readonly resources?: ReadonlyArray<unknown>;
105
+ readonly execute: (input: In, ctx: AgentToolContext) => Effect.Effect<Out, any, R>;
106
+ }
107
+ /**
108
+ * Defines a custom typed tool for a Keel `Agent`, automatically generating its
109
+ * JSON Schema for LLMs, validating inputs, enforcing optional IAM permissions,
110
+ * and supporting human-in-the-loop `Signal` approvals.
111
+ *
112
+ * Accepts either Effect `Schema` + `Effect` handlers OR Standard Schema / `k.*`
113
+ * schemas + plain sync/`async` functions.
114
+ */
115
+ export declare function agentTool<const Name extends string, In, Out, R = never>(config: {
116
+ readonly name: Name;
117
+ readonly description: string;
118
+ readonly input: Schema.Codec<In, any, never, never>;
119
+ readonly output?: Schema.Codec<Out, any, never, never>;
120
+ readonly auth?: IamAuthRule<string>;
121
+ readonly iam?: IamDef<any, any, any>;
122
+ readonly requiresApproval?: AgentToolApprovalRule<In>;
123
+ readonly resources?: ReadonlyArray<unknown>;
124
+ readonly execute: (input: In, ctx: AgentToolContext) => Effect.Effect<Out, any, R>;
125
+ }): AgentToolDef<Name, In, Out, R>;
126
+ export declare function agentTool<const Name extends string, In extends SchemaLike, Out = unknown>(config: {
127
+ readonly name: Name;
128
+ readonly description: string;
129
+ readonly input: In;
130
+ readonly output?: SchemaLike;
131
+ readonly auth?: IamAuthRule<string>;
132
+ readonly iam?: IamDef<any, any, any>;
133
+ readonly requiresApproval?: AgentToolApprovalRule<InferSchema<In>>;
134
+ readonly resources?: ReadonlyArray<unknown>;
135
+ readonly execute: (input: InferSchema<In>, ctx: AgentToolContext) => Promise<Out> | Out | Effect.Effect<Out, any, any>;
136
+ }): AgentToolDef<Name, InferSchema<In>, Out, any>;
137
+ /**
138
+ * Declaratively exposes an existing Keel `Service` operation as a typed Agent
139
+ * tool — inheriting its input/output schemas, auto-generating JSON Schema,
140
+ * and enforcing its declared IAM permissions against `CurrentPrincipal`.
141
+ */
142
+ export declare const serviceTool: <Self, SvcName extends string, Ops extends ServiceOperationsMap, const OpName extends keyof Ops & string, const ToolName extends string = `${SvcName}_${OpName}`>(service: ServiceDescriptor<Self, SvcName, Ops>, opName: OpName, options?: {
143
+ readonly name?: ToolName;
144
+ readonly description?: string;
145
+ readonly auth?: IamAuthRule<string>;
146
+ readonly requiresApproval?: AgentToolApprovalRule<Ops[OpName]["input"]["Type"]>;
147
+ }) => AgentToolDef<ToolName, Ops[OpName]["input"]["Type"], Ops[OpName]["output"]["Type"], Self>;
148
+ declare const SandboxToolInputSchema: Schema.Struct<{
149
+ readonly command: Schema.String;
150
+ readonly files: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
151
+ readonly readPaths: Schema.optional<Schema.$Array<Schema.String>>;
152
+ readonly cwd: Schema.optional<Schema.String>;
153
+ }>;
154
+ export type SandboxToolInput = typeof SandboxToolInputSchema.Type;
155
+ export interface SandboxToolOutput {
156
+ readonly exitCode: number;
157
+ readonly stdout: string;
158
+ readonly stderr: string;
159
+ readonly files: Record<string, string>;
160
+ }
161
+ /**
162
+ * Declaratively exposes a Keel `Sandbox` as a typed Agent tool for isolated
163
+ * code execution. Creates a scoped sandbox per call, writes optional files,
164
+ * executes `command`, reads optional `readPaths`, and destroys the sandbox.
165
+ */
166
+ export declare const sandboxTool: <S extends SandboxDef, const ToolName extends string = `sandbox_${S["sandboxName"]}`>(sandbox: S, options?: {
167
+ readonly name?: ToolName;
168
+ readonly description?: string;
169
+ readonly auth?: IamAuthRule<string>;
170
+ readonly iam?: IamDef<any, any, any>;
171
+ readonly requiresApproval?: AgentToolApprovalRule<SandboxToolInput>;
172
+ readonly defaultTimeout?: Duration.Input;
173
+ }) => AgentToolDef<ToolName, SandboxToolInput, SandboxToolOutput, SandboxRuntime>;
174
+ declare const SearchToolInputSchema: Schema.Struct<{
175
+ readonly query: Schema.String;
176
+ readonly limit: Schema.optional<Schema.Int>;
177
+ readonly filter: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
178
+ }>;
179
+ export type SearchToolInput = typeof SearchToolInputSchema.Type;
180
+ /**
181
+ * Declaratively exposes a Keel `SearchIndex` as a typed RAG retrieval tool
182
+ * supporting full-text BM25, vector KNN, or hybrid RRF search.
183
+ */
184
+ export declare const searchTool: <I extends SearchIndexDef, const ToolName extends string = `search_${I["indexName"]}`>(index: I, options?: {
185
+ readonly name?: ToolName;
186
+ readonly description?: string;
187
+ readonly mode?: "text" | "vector" | "hybrid";
188
+ readonly defaultLimit?: number;
189
+ /** Embedding function used for `"vector"` or `"hybrid"` RAG search. */
190
+ readonly embed?: (query: string) => Promise<ReadonlyArray<number>> | Effect.Effect<ReadonlyArray<number>, any, any>;
191
+ readonly auth?: IamAuthRule<string>;
192
+ readonly iam?: IamDef<any, any, any>;
193
+ readonly requiresApproval?: AgentToolApprovalRule<SearchToolInput>;
194
+ }) => AgentToolDef<ToolName, SearchToolInput, ReadonlyArray<unknown>, SearchEngine | VectorSearch>;
195
+ export interface AgentConfig<OutSchema extends Schema.Codec<any, any, never, never> = typeof Schema.String, Tools extends ReadonlyArray<AgentToolDef<any, any, any, any>> = ReadonlyArray<AgentToolDef<any, any, any, any>>> {
196
+ /** Model identifier passed to `LlmProvider` (e.g. `"claude-sonnet-4-20250514"`, `"gpt-4o"`, `"gemini-2.5-pro"`, `"openrouter/anthropic/claude-3.7-sonnet"`). */
197
+ readonly model: string;
198
+ /** System instructions guiding the agent's behavior. */
199
+ readonly instructions: string | ((ctx: {
200
+ readonly metadata?: Record<string, unknown>;
201
+ }) => string);
202
+ /** Typed tools available to this agent (`agentTool`, `serviceTool`, `sandboxTool`, `searchTool`). */
203
+ readonly tools?: Tools;
204
+ /** Optional typed output schema. Defaults to `Schema.String`. */
205
+ readonly output?: OutSchema;
206
+ /** Optional IAM descriptor used for tool-level `auth` checks. */
207
+ readonly iam?: IamDef<any, any, any>;
208
+ /** Maximum LLM reasoning turns per invocation before failing with `AgentMaxStepsError`. Default: `10`. */
209
+ readonly maxSteps?: number;
210
+ readonly temperature?: number;
211
+ readonly maxTokens?: number;
212
+ /** Timeout waiting for human-in-the-loop approval signals. Default: `"24 hours"`. */
213
+ readonly approvalTimeout?: Duration.Input;
214
+ /**
215
+ * Behavior when a human rejects a tool approval signal:
216
+ * - `"return_to_model"` (default): feeds the rejection back as a tool error message so the model can respond gracefully.
217
+ * - `"fail"`: immediately fails the run with `AgentApprovalRejectedError`.
218
+ */
219
+ readonly onApprovalRejected?: "return_to_model" | "fail";
220
+ }
221
+ export interface AgentDef<Name extends string = string, OutSchema extends Schema.Codec<any, any, never, never> = Schema.Codec<any, any, never, never>, Tools extends ReadonlyArray<AgentToolDef<any, any, any, any>> = ReadonlyArray<AgentToolDef<any, any, any, any>>> {
222
+ readonly agentName: Name;
223
+ readonly model: string;
224
+ readonly instructions: string | ((ctx: {
225
+ readonly metadata?: Record<string, unknown>;
226
+ }) => string);
227
+ readonly tools: Tools;
228
+ readonly output: OutSchema;
229
+ readonly iam: IamDef<any, any, any> | undefined;
230
+ readonly maxSteps: number;
231
+ readonly temperature: number | undefined;
232
+ readonly maxTokens: number | undefined;
233
+ readonly approvalTimeout: Duration.Input;
234
+ readonly onApprovalRejected: "return_to_model" | "fail";
235
+ readonly tableName: string;
236
+ readonly approvalSignalName: string;
237
+ }
238
+ export type AgentOutputOf<A extends AgentDef> = A["output"]["Type"];
239
+ type AgentToolRequirement<T> = T extends AgentToolDef<any, any, any, infer R> ? R : never;
240
+ export type AgentRequirementsOf<A extends AgentDef> = LlmProvider | WorkflowStore | RelationalStore | AgentToolRequirement<A["tools"][number]>;
241
+ export declare const agentRunsTableName: (agentName: string) => string;
242
+ export declare const agentApprovalSignalName: (agentName: string) => string;
243
+ export declare const Agent: <const Name extends string, OutSchema extends Schema.Codec<any, any, never, never> = typeof Schema.String, const Tools extends ReadonlyArray<AgentToolDef<any, any, any, any>> = readonly []>(agentName: Name, config: AgentConfig<OutSchema, Tools>) => {
244
+ new (): {};
245
+ readonly agentName: Name;
246
+ readonly model: string;
247
+ readonly instructions: string | ((ctx: {
248
+ readonly metadata?: Record<string, unknown>;
249
+ }) => string);
250
+ readonly tools: Tools;
251
+ readonly output: OutSchema;
252
+ readonly iam: IamDef<any, any, any> | undefined;
253
+ readonly maxSteps: number;
254
+ readonly temperature: number | undefined;
255
+ readonly maxTokens: number | undefined;
256
+ readonly approvalTimeout: Duration.Input;
257
+ readonly onApprovalRejected: "return_to_model" | "fail";
258
+ readonly tableName: string;
259
+ readonly approvalSignalName: string;
260
+ readonly resources: ReadonlyArray<unknown>;
261
+ readonly [KeelKindSym]: "agent";
262
+ readonly [KeelMetaSym]: {
263
+ kind: "agent";
264
+ name: Name;
265
+ model: string;
266
+ tools: any[];
267
+ tableName: string;
268
+ hasApprovalTools: boolean;
269
+ };
270
+ readonly [KeelInfraSym]: () => {
271
+ children: unknown[];
272
+ };
273
+ readonly [KeelDefaultLayerSym]: () => import("effect/Layer").Layer<LlmProvider, never, never>;
274
+ readonly [KeelEnsureSym]: () => Effect.Effect<void, import("@chimp-labs/keel").SqlQueryError, RelationalStore>;
275
+ readonly [KeelBindSym]: (runner: SdkRunner) => BoundAgent<AgentDef<Name, OutSchema, Tools>>;
276
+ };
277
+ /** Deterministic Keel `Signal` used to approve or reject pending tool calls for an `Agent`. */
278
+ export declare const AgentApprovalSignal: <A extends AgentDef>(agent: A) => {
279
+ new (): {};
280
+ readonly signalName: string;
281
+ readonly payload: Schema.Struct<{
282
+ readonly callId: Schema.String;
283
+ readonly approved: Schema.Boolean;
284
+ readonly reason: Schema.optional<Schema.String>;
285
+ readonly approverId: Schema.optional<Schema.String>;
286
+ readonly modifiedInput: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
287
+ }>;
288
+ readonly [KeelKindSym]: "signal";
289
+ readonly [KeelMetaSym]: {
290
+ kind: "signal";
291
+ name: string;
292
+ };
293
+ };
294
+ /** Ensures the internal durable runs `Table` for `agent` exists on `RelationalStore`. */
295
+ export declare const ensureAgentTable: <A extends AgentDef>(agent: A) => Effect.Effect<void, import("@chimp-labs/keel").SqlQueryError, RelationalStore>;
296
+ /** Sends a human-in-the-loop approval or rejection `Signal` to a suspended agent run. */
297
+ export declare const approveAgentTool: <A extends AgentDef>(agent: A, runId: string, decision: AgentApprovalDecision) => Effect.Effect<void, WorkflowStoreError | Schema.SchemaError, WorkflowStore>;
298
+ /** Reads the current durable state, transcript, and pending approval of an agent run. */
299
+ export declare const getAgentRun: <A extends AgentDef>(agent: A, runId: string) => Effect.Effect<AgentRunRecord<AgentOutputOf<A>>, AgentNotFoundError | AgentError, RelationalStore>;
300
+ /** Lists all persisted runs for an agent. */
301
+ export declare const listAgentRuns: <A extends AgentDef>(agent: A) => Effect.Effect<ReadonlyArray<AgentRunRecord<AgentOutputOf<A>>>, AgentError, RelationalStore>;
302
+ export interface RunAgentOptions {
303
+ /** Durable run identifier. Auto-generated if omitted; reuse to resume after crash or continue a conversation. */
304
+ readonly runId?: string;
305
+ /** User prompt for this turn. */
306
+ readonly prompt: string;
307
+ /** Override `agent.maxSteps` for this invocation. */
308
+ readonly maxSteps?: number;
309
+ /** Override `agent.temperature` for this invocation. */
310
+ readonly temperature?: number;
311
+ /** Override `agent.maxTokens` for this invocation. */
312
+ readonly maxTokens?: number;
313
+ /** Override `agent.approvalTimeout` for this invocation. */
314
+ readonly approvalTimeout?: Duration.Input;
315
+ /** Optional metadata passed to `instructions(ctx)` and `LlmProvider`. */
316
+ readonly metadata?: Record<string, unknown>;
317
+ }
318
+ export interface AgentRunResult<Out = unknown> {
319
+ readonly runId: string;
320
+ readonly agent: string;
321
+ readonly output: Out;
322
+ readonly messages: ReadonlyArray<LlmMessage>;
323
+ readonly stepCount: number;
324
+ readonly totalInputTokens: number;
325
+ readonly totalOutputTokens: number;
326
+ }
327
+ /**
328
+ * Runs a durable multi-turn AI `Agent` backed by:
329
+ * - `LlmProvider` (swappable: Memory, OpenAI, Anthropic, Gemini, Bedrock, Ollama, OpenRouter, LiteLLM)
330
+ * - `WorkflowStore` (step-level journaling for crash-resume + live `Signal` human-in-the-loop approvals)
331
+ * - `RelationalStore` (persisted run transcripts, token usage, and pending approval state)
332
+ * - Optional tool dependencies (`Service`, `SandboxRuntime`, `SearchEngine`, `VectorSearch`, `IAM`)
333
+ */
334
+ export declare const runAgent: <A extends AgentDef>(agent: A, options: RunAgentOptions) => Effect.Effect<AgentRunResult<AgentOutputOf<A>>, AgentError | AgentMaxStepsError | AgentApprovalRejectedError | AgentApprovalTimeoutError | AgentToolError | LlmError | LlmRateLimitError | WorkflowStoreError | UnauthorizedError | ForbiddenError | IamStoreError, AgentRequirementsOf<A>>;
335
+ /** Continues an existing durable multi-turn agent conversation on `runId`. */
336
+ export declare const continueAgent: <A extends AgentDef>(agent: A, runId: string, prompt: string, options?: Omit<RunAgentOptions, "runId" | "prompt">) => Effect.Effect<AgentRunResult<AgentOutputOf<A>>, LlmError | LlmRateLimitError | AgentError | AgentMaxStepsError | AgentApprovalRejectedError | AgentApprovalTimeoutError | AgentToolError | WorkflowStoreError | UnauthorizedError | ForbiddenError | IamStoreError, AgentRequirementsOf<A>>;
337
+ export declare const bindAgent: <A extends AgentDef>(runner: SdkRunner, agentDef: A) => {
338
+ descriptor: A;
339
+ ensure: (options?: SdkCallOptions) => Promise<void>;
340
+ run: (options: RunAgentOptions & SdkCallOptions) => Promise<AgentRunResult<AgentOutputOf<A>>>;
341
+ continue: (runId: string, prompt: string, options?: Omit<RunAgentOptions, "runId" | "prompt"> & SdkCallOptions) => Promise<AgentRunResult<AgentOutputOf<A>>>;
342
+ approve: (runId: string, decision: AgentApprovalDecision, options?: SdkCallOptions) => Promise<void>;
343
+ getRun: (runId: string, options?: SdkCallOptions) => Promise<AgentRunRecord<AgentOutputOf<A>>>;
344
+ listRuns: (options?: SdkCallOptions) => Promise<ReadonlyArray<AgentRunRecord<AgentOutputOf<A>>>>;
345
+ };
346
+ export type BoundAgent<A extends AgentDef> = ReturnType<typeof bindAgent<A>>;
347
+ /** Plain TypeScript SDK descriptor builder for `Agent` (supports Standard Schema v1 & `k.*`). */
348
+ export declare const agent: <const Name extends string, Out extends SchemaLike = typeof Schema.String, const Tools extends ReadonlyArray<AgentToolDef<any, any, any, any>> = readonly []>(agentName: Name, config: {
349
+ readonly model: string;
350
+ readonly instructions: string | ((ctx: {
351
+ readonly metadata?: Record<string, unknown>;
352
+ }) => string);
353
+ readonly tools?: Tools;
354
+ readonly output?: Out;
355
+ readonly iam?: IamDef<any, any, any>;
356
+ readonly maxSteps?: number;
357
+ readonly temperature?: number;
358
+ readonly maxTokens?: number;
359
+ readonly approvalTimeout?: Duration.Input;
360
+ readonly onApprovalRejected?: "return_to_model" | "fail";
361
+ }) => KeelResource<"agent"> & AgentDef<Name, Schema.Codec<InferSchema<Out>, any, never, never>, Tools> & {
362
+ readonly [KeelBindSym]: (runner: SdkRunner) => BoundAgent<AgentDef<Name, Schema.Codec<InferSchema<Out>, any, never, never>, Tools>>;
363
+ };
364
+ export {};
365
+ //# sourceMappingURL=agent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