Skip to main content
Pass a Pydantic model as output_schema and the agent’s reply is guaranteed to match that model’s structure — ideal for extraction and classification where you want to parse the result directly.

Define a schema and create the agent

Parse the result

run returns a JSON string that matches the schema, which you can parse directly with Pydantic:

Use Ark-native structured output

Adding enable_responses=True to the above makes VeADK use Volcengine Ark’s Responses API, converting output_schema into Ark’s native json_schema (strict: true) enforced on the model side. This is more reliable than the default approach, which relies on prompting the model to produce JSON.
This relies on Ark’s Responses API and therefore requires an Ark model.
When output_schema is set, the agent returns only the structured result and cannot call tools or transfer to sub-agents.
Last modified on September 19, 2026