feat: structured output support for schema inference and runtime extraction#191
Merged
cristipufu merged 2 commits intomainfrom Feb 22, 2026
Merged
feat: structured output support for schema inference and runtime extraction#191cristipufu merged 2 commits intomainfrom
cristipufu merged 2 commits intomainfrom
Conversation
…result - Infer output JSON schema from response_format on output executors in get_entrypoints_schema(), returning the Pydantic model schema instead of the default messages schema. - Fix runtime result extraction to return structured dict output instead of wrapping it in messages: check AgentResponse.value for non-streaming, concatenate streaming tokens and parse via response_format for streaming. - Fix streaming token corruption caused by joining with "\n\n" separators. - Update structured-output sample to pass response_format via default_options so it actually reaches the LLM API. - Add missing agent_framework.json for sequential, magentic, and structured-output samples. - Update samples README table with all samples ordered by difficulty. - Add tests for schema inference, non-streaming result, and streaming result (matching production behavior with chunked AgentResponseUpdate tokens). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
e450650 to
ed3c138
Compare
The runtime and schema extraction only checked output_executors for response_format, which missed sequential workflows where the output executor is _EndWithConversation (not an AgentExecutor). Add fallback to scan all workflow executors and pick the last agent's response_format. Includes e2e streaming tests and a sequential-structured-output sample. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ed3c138 to
3e6ff28
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
get_entrypoints_schema()now returns the Pydantic model JSON schema fromresponse_formaton output executors, instead of the default messages schema_EndWithConversationin sequential orchestrations)"\n\n"separatorssequential-structured-output— researcher + editor pipeline producing a typedCityInfoPydantic modelChanges
Runtime (
runtime.py)_extract_workflow_output()checksAgentResponse.valuefor structured data_try_parse_structured_output()validates concatenated streaming tokens against theresponse_formatPydantic model_get_output_response_format()falls back to scanning all workflow executors for the lastAgentExecutorwith aresponse_formatSchema (
schema.py)_extract_output_schema()same fallback: scans all workflow executors when output executors don't have aresponse_formatTests (
test_schema.py)TestStructuredOutput— schema extraction, streaming, and non-streaming for single-agent workflowsTestSequentialStructuredOutput— same coverage for sequential workflows with 3 chained agentsSample (
samples/sequential-structured-output/)CityInfostructured outputREADME.md,pyproject.toml,agent_framework.json,uipath.json,entry-points.jsonTest plan
uipath initgenerates correctentry-points.jsonwith CityInfo schema for the new sample🤖 Generated with Claude Code