structured-output

Convert LlmAgent model responses into validated Pydantic objects using output_schema.

19|6|Updated Mar 12, 2026
One-click install
npx skills add https://github.com/NicolaiLassen/orxhestra --skill structured-output-nicolailassen
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: structured-output
Source: https://github.com/NicolaiLassen/orxhestra/tree/main/docs/skills/structured-output
Command: npx skills add https://github.com/NicolaiLassen/orxhestra --skill structured-output-nicolailassen

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Structured-output helps you stop unreliable free-form responses by forcing LLM agents to return validated, typed Pydantic objects you can safely consume in your code.

Core Features & Use Cases

  • Typed responses with Pydantic: Provide an output_schema so the agent returns a validated model instance instead of text.
  • JSON extraction + validation: The system appends format instructions, parses JSON, and validates against your schema.
  • Streaming-friendly parsing: Works with astream() so you can inspect the final typed object once the response completes.

Quick Start

Use structured-output to configure your LlmAgent with an output_schema like CompanyAnalysis and then parse the final event to read analysis.recommendation and analysis.confidence.

Frequently Asked Questions about structured-output

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I get reliable JSON parsing from an LLM agent?

To get reliable JSON parsing from an LLM agent, you provide an output_schema so the agent returns a validated Pydantic object instead of free-form text. The system appends parser format instructions, extracts JSON, and validates it against your schema.

What is the best way to enforce schema validation on streaming LLM responses?

Schema validation on streaming responses works with astream() to inspect the final typed object once the response completes. You supply a Pydantic output_schema, and the parser extracts and validates the JSON chunks as they arrive.

How do I use Pydantic to extract structured data from multi-agent workflows?

To use Pydantic to extract structured data from multi-agent workflows, configure your LlmAgent with a defined output_schema. This enforces consistent structured data extraction across multi-agent compositions by validating model responses into typed objects.

Does structured output work with agents that occasionally return malformed JSON?

Structured output handles malformed JSON by providing a fallback structured parsing path. If standard JSON extraction fails, the fallback path attempts to recover and validate the response against your Pydantic schema.