Skip to content

[One Workflow] feat: Type inference for ai.prompt step output from output schema#246504

Merged
skynetigor merged 83 commits intoelastic:mainfrom
skynetigor:15061-Type-inference-for-ai.prompt-step-output-from-outputSchema
Feb 4, 2026
Merged

[One Workflow] feat: Type inference for ai.prompt step output from output schema#246504
skynetigor merged 83 commits intoelastic:mainfrom
skynetigor:15061-Type-inference-for-ai.prompt-step-output-from-outputSchema

Conversation

@skynetigor
Copy link
Copy Markdown
Contributor

@skynetigor skynetigor commented Dec 16, 2025

closes: https://github.com/elastic/security-team/issues/15061

Screen.Recording.2026-01-21.at.13.24.00.mov

Summary

Add type inference support for the AI prompt step, enabling dynamic output schema validation based on user-defined JSON Schema. This change allows workflows to leverage strongly-typed outputs from AI prompts when an outputSchema is provided, improving type safety and developer experience in workflow definitions. The implementation includes schema validation, dynamic type inference for both string and structured outputs, and enhanced connector ID autocomplete for AI steps.

New Features

  • Dynamic Output Schema Inference: Add type inference for ai.prompt step outputs based on user-provided JSON Schema, allowing strongly-typed workflow variables downstream
  • System Prompt Support: Add optional systemPrompt field to ai.prompt step input schema for better control over AI model behavior
  • Enhanced Schema Validation: Add title and description fields to JsonModelSchema for richer workflow input documentation
  • AI Connector Autocomplete: Improve connector ID suggestions in YAML editor to support AI-specific connectors (gen-ai.run) for AI workflow steps

Key Capabilities

  • Type-Safe AI Outputs: When a schema is provided in the ai.prompt step, the output type is automatically inferred, enabling IDE autocomplete and validation for workflow variables
  • Structured Output Support: Use getStructuredOutputSchema() helper to wrap custom schemas with metadata, providing consistent output structure across all AI steps
  • Enhanced Developer Experience: Connector ID autocomplete now intelligently suggests AI connectors (GenAI, Inference) when editing AI workflow steps

@skynetigor skynetigor added release_note:skip Skip the PR/issue when compiling release notes backport:skip This PR does not require backporting Team:One Workflow Team label for One Workflow (Workflow automation) labels Dec 16, 2025
@skynetigor skynetigor enabled auto-merge (squash) January 23, 2026 09:31
@skynetigor
Copy link
Copy Markdown
Contributor Author

@elasticmachine merge upstream

@skynetigor skynetigor requested a review from a team as a code owner February 3, 2026 09:58
Copy link
Copy Markdown
Contributor

@semd semd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@skynetigor skynetigor merged commit 38ea011 into elastic:main Feb 4, 2026
16 checks passed
@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
agentBuilder 1430 1441 +11
workflowsExtensions 97 108 +11
workflowsManagement 1257 1258 +1
total +23

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
workflowsManagement 1.4MB 1.4MB +276.0B

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
agentBuilder 73.8KB 85.9KB +12.1KB
workflowsExtensions 74.0KB 79.9KB +5.8KB
total +17.9KB

History

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting release_note:skip Skip the PR/issue when compiling release notes Team:One Workflow Team label for One Workflow (Workflow automation) v9.4.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants