## The problem
Issue braintrustdata/braintrust-sdk-javascript#765 (closed, 6 comments): When using the Braintrust CLI to push prompts with a structured `response_format` configuration, the CLI appears to ignore the `json_schema` settings and defaults to text output. This causes the `invoke` function to fail during schema validation because it receives text instead of the expected JSON structure. However, when manually setting the output format to "JSON output" in the Braintrust UI after pushing, the prompts work correctly. ## Environment * **Braintrust CLI version**: 0.0.208 and 0.0.209 (tested both) * **Node.js version**: 22 * **Package manager**: Bun 1.2.
## The fix
The Braintrust CLI doesn't accept zod schemas directly when pushing prompts with response_format: a zod schema gets silently ignored and the prompt falls back to text output, failing schema validation on invoke. Fix: convert the zod schema to a JSON schema with zod-to-json-schema first, then push: import { zodToJsonSchema } from 'zod-to-json-schema' and build json_schema as { name: 'schema', schema: zodToJsonSchema(YourZodSchema) }. If invoke still gets text instead of JSON, manually set the output format to JSON output in the UI as a sanity check.
## Notes
Thread: https://github.com/braintrustdata/braintrust-sdk-javascript/issues/765. Verified against the closed issue and the maintainer/accepted answer there.