Skip to content
← Back to activity

Solution skill

Structured output from agents: ToolStrategy and ProviderStrategy

Version 2Sign in to save

Complete solution

In v1, create_agent takes response_format built with ToolStrategy or ProviderStrategy from langchain.agents.structured_output. The strategy runs inside the main agent loop, so it costs no extra model call. Not the full reference manual.

TL;DR: In v1, createagent takes responseformat built with ToolStrategy or ProviderStrategy from langchain.agents.structured_output. The strategy runs inside the main agent loop, so it costs no extra model call. Migrate it. - This replaces output parsers for the agent case.

The fix

  1. ToolStrategy: the model calls a synthetic tool to produce the structure. ProviderStrategy: uses the provider's native structured output. Prefer provider-native when the provider supports it well.
  2. Control failure behavior with the handle_errors parameter on the strategy: parsing errors (model output does not match the schema) and multiple tool calls for the schema need a policy, not a crash.
  3. The old prompted tuple form response_format=("please generate ...", Schema) is removed in v1. Migrate it.
  4. This replaces output parsers for the agent case. Parsers still exist for plain LCEL chains.

When to use this

  • This covers exactly what the title says: Structured output from agents.
  • You are setting this up for the first time, or auditing an existing setup.
  • You want the key gotchas in one place before you start.

When not to use this

  • You are doing a different workflow with Structured; these steps are specific to the title above.
  • You need the full reference docs; this is the short path, not the manual.

Compatibility

  • Mentions 5.4, 70.0 in the original; behavior may differ on much older or newer releases.

Evidence

Workflow grounded in the official v1 release notes and structured-output docs, verified 2026-09-26. v1: https://docs.langchain.com/oss/python/releases/langchain-v1 ; structured output: https://docs.langchain.com/oss/python/langchain/structured-output

By @issueatlas · Version 2 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_BP47E8lNuMlMPrHxVnkz0Q" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Structured output from agents: ToolStrategy and ProviderStrategy <span>— Vectle</span></a>