Skip to content

Commit 7a2dd3a

Browse files
feat(docs): add structured output parameters and examples to AI agent documentation
1 parent 2932e10 commit 7a2dd3a

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

docs/components/ai.mdx

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,16 @@ An autonomous agent that uses reasoning steps and tool-calling to solve complex
103103
| `temperature` | Number | Reasoning creativity (default 0.7) |
104104
| `stepLimit` | Number | Max "Think -> Act -> Observe" loops (1-12) |
105105
| `memorySize` | Number | Number of previous turns to retain in context |
106+
| `structuredOutputEnabled` | Toggle | Enable to enforce a specific JSON output structure |
107+
| `schemaType` | Select | How to define the schema: `json-example` or `json-schema` |
108+
| `jsonExample` | JSON | Example JSON object for schema inference (all properties become required) |
109+
| `jsonSchema` | JSON | Full JSON Schema definition for precise validation |
110+
| `autoFixFormat` | Toggle | Attempt to extract valid JSON from malformed responses |
106111

107112
| Output | Type | Description |
108113
|--------|------|-------------|
109114
| `responseText`| Text | Final answer after reasoning is complete |
115+
| `structuredOutput` | JSON | Parsed structured output (when enabled) |
110116
| `conversationState` | JSON | Updated state to pass to the next agent node |
111117
| `reasoningTrace` | JSON | Detailed step-by-step logs of the agent's thoughts |
112118
| `agentRunId` | Text | Unique session ID for tracking and streaming |
@@ -168,6 +174,19 @@ Analyze incoming security alerts to filter out false positives.
168174
An agent that searches through logs and performs lookups to investigate a specific IP address.
169175
**Task:** "Investigate the IP {{ip}} using the available Splunk and VirusTotal tools."
170176

177+
### Structured Output for Data Extraction
178+
**Flow:** `Provider``AI Agent` (with Structured Output enabled)
179+
180+
Extract structured data from unstructured security reports. Enable **Structured Output** and provide a JSON example:
181+
```json
182+
{
183+
"severity": "high",
184+
"affected_systems": ["web-server-01"],
185+
"remediation_steps": ["Patch CVE-2024-1234", "Restart service"]
186+
}
187+
```
188+
The agent will always return validated JSON matching this schema, ready for downstream processing.
189+
171190
---
172191

173192
## Best Practices
@@ -177,7 +196,7 @@ An agent that searches through logs and performs lookups to investigate a specif
177196
</Note>
178197

179198
### Prompt Engineering
180-
1. **Format Outputs**: If you need JSON for a downstream node, ask for it explicitly in the prompt: "Return only valid JSON with fields 'risk' and 'reason'."
199+
1. **Use Structured Output**: When you need consistent JSON for downstream nodes, enable **Structured Output** instead of relying on prompt instructions. This guarantees schema compliance and eliminates parsing errors.
181200
2. **Use System Prompts**: Set high-level rules (e.g., "You are a senior security researcher") in the System Prompt parameter instead of the User Input.
182201
3. **Variable Injection**: Use `{{variableName}}` syntax to inject data from upstream nodes into your prompts.
183202

worker/tsconfig.tsbuildinfo

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)