agent-lattice 0.9.14 → 0.9.15

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 CHANGED
@@ -56,6 +56,28 @@ Pass `{ stream: false }` to disable model streaming for a query:
56
56
  const result = await agent.prompt("Say hello", { stream: false });
57
57
  ```
58
58
 
59
+ Pass `outputFormat` when you want the model to produce JSON matching a schema:
60
+
61
+ ```ts
62
+ const jsonResult = await agent.prompt("Return JSON only.", {
63
+ outputFormat: "json",
64
+ });
65
+
66
+ const result = await agent.prompt("Return the answer to 2 + 2.", {
67
+ outputFormat: {
68
+ type: "json_schema",
69
+ schema: {
70
+ type: "object",
71
+ properties: {
72
+ answer: { type: "number" },
73
+ },
74
+ required: ["answer"],
75
+ additionalProperties: false,
76
+ },
77
+ },
78
+ });
79
+ ```
80
+
59
81
  ## Multimodal Input
60
82
 
61
83
  Pass Anthropic-compatible content blocks for image or document prompts:
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { DocumentBlockParam, ImageBlockParam, TextBlockParam } from "@anthropic-ai/sdk/resources/messages.mjs";
2
+ import type { BetaJSONOutputFormat } from "@anthropic-ai/sdk/resources/beta/messages/messages.mjs";
2
3
  import type { OAuthClientProvider } from "@modelcontextprotocol/sdk/client/auth.js";
3
4
  import { type StdioServerParameters } from "@modelcontextprotocol/sdk/client/stdio.js";
4
5
  import { type StreamableHTTPClientTransportOptions } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
@@ -149,6 +150,7 @@ export type ModelRequest = {
149
150
  messages: ModelMessage[];
150
151
  tools: ModelToolDefinition[];
151
152
  stream: boolean;
153
+ outputFormat?: OutputFormat;
152
154
  onStreamEvent?: (event: Record<string, unknown>) => void;
153
155
  signal?: AbortSignal;
154
156
  };
@@ -375,12 +377,14 @@ export type AgentWorkspaceToolsOptions = {
375
377
  };
376
378
  export type QueryOptions<TContext = unknown> = {
377
379
  stream?: boolean;
380
+ outputFormat?: OutputFormat;
378
381
  signal?: AbortSignal;
379
382
  context?: TContext;
380
383
  agentRuntime?: AgentRuntimeContext;
381
384
  permissions?: RuntimePermissions;
382
385
  tracer?: ContextTracer;
383
386
  };
387
+ export type OutputFormat = "json" | BetaJSONOutputFormat;
384
388
  export type SDKSystemInitMessage = {
385
389
  type: "system";
386
390
  subtype: "init";
@@ -512,6 +516,7 @@ export declare function createAgentWorkspaceTools(options?: AgentWorkspaceToolsO
512
516
  export declare function query<TContext = unknown>(params: AgentOptions<TContext> & {
513
517
  prompt: string;
514
518
  stream?: boolean;
519
+ outputFormat?: OutputFormat;
515
520
  signal?: AbortSignal;
516
521
  context?: TContext;
517
522
  }): AsyncGenerator<SDKMessage>;