Skip to content

[BUG] ensure support for JSONSchema7 in AgentExecutionOptions for output #7541

@roaminro

Description

@roaminro

Problem Statement

You currently cannot use a JSONSchema7as output with agent.generateVNext

Type 'JSONSchema7' is not assignable to type 'OutputSchema'.
  Type 'JSONSchema7' is missing the following properties from type 'ZodType<any, any, $ZodTypeInternals<any, any>>': def, _def, _output, _input, and 30 more.ts(2322)

Proposed Solution

ensure support for JSONSchema7 for output

Component

Agents

Alternatives Considered

No response

Example Use Case

const jsonSchema: JSONSchema7 = {
  type: "object",
  properties: {
    name: { type: "string" },
    age: { type: "number" },
    city: { type: "string" },
    preferences: {
      type: "object",
      properties: {
        theme: { type: "string" },
        notifications: { type: "boolean" },
      },
    },
  },
  required: ["name", "city"],
};

agent.generateVNext('...', {
   //...
   output: jsonSchema
})

Additional Context

No response

Verification

  • I have searched the existing issues to make sure this is not a duplicate
  • I have provided sufficient context for the team to understand the request

Metadata

Metadata

Labels

AgentsIssues regarding Mastra's Agent primitivebugSomething isn't workingp: urgentUrgent priority

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions