agent-lattice 0.9.15 → 0.9.16

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
@@ -78,6 +78,22 @@ const result = await agent.prompt("Return the answer to 2 + 2.", {
78
78
  });
79
79
  ```
80
80
 
81
+ When `outputFormat` is set, the SDK verifies that the final answer is a pure
82
+ JSON value. If a compatible provider ignores structured output parameters and
83
+ returns Markdown or prose, the run finishes with an error result.
84
+
85
+ For GLM/ZAI-compatible providers, use `structuredOutputMode: "json_object"` if
86
+ your `baseURL` is a custom proxy that auto-detection cannot recognize:
87
+
88
+ ```ts
89
+ const agent = createAgent({
90
+ apiKey: process.env.ZAI_API_KEY,
91
+ baseURL: "https://api.bigmodel.cn/anthropic",
92
+ model: "glm-5.2",
93
+ structuredOutputMode: "json_object",
94
+ });
95
+ ```
96
+
81
97
  ## Multimodal Input
82
98
 
83
99
  Pass Anthropic-compatible content blocks for image or document prompts:
package/dist/index.d.ts CHANGED
@@ -357,6 +357,7 @@ export type AgentWorkspaceOptions = string | {
357
357
  export type AgentOptions<TContext = unknown> = {
358
358
  apiKey?: string;
359
359
  baseURL?: string;
360
+ structuredOutputMode?: StructuredOutputMode;
360
361
  name?: string;
361
362
  model: string;
362
363
  systemPrompt?: string;
@@ -385,6 +386,7 @@ export type QueryOptions<TContext = unknown> = {
385
386
  tracer?: ContextTracer;
386
387
  };
387
388
  export type OutputFormat = "json" | BetaJSONOutputFormat;
389
+ export type StructuredOutputMode = "auto" | "anthropic" | "json_object";
388
390
  export type SDKSystemInitMessage = {
389
391
  type: "system";
390
392
  subtype: "init";
@@ -457,6 +459,8 @@ export declare class MaxTurnsError extends AgentSDKError {
457
459
  }
458
460
  export declare class AbortError extends AgentSDKError {
459
461
  }
462
+ export declare class StructuredOutputError extends AgentSDKError {
463
+ }
460
464
  export declare class ToolPermissionDeniedError extends AgentSDKError {
461
465
  readonly denial: PermissionDenial;
462
466
  constructor(denial: PermissionDenial);