Register and share your invite link to earn from video plays and referrals.

cv usk
@cv_usk
AI / Software Research Notes AI Agent, LLMOps, MLOps, Software Architecture ๆŠ•็จฟใฏๅ€‹ไบบใฎๆ„่ฆ‹ใงใ™ใ€‚
Joined May 2026
257 Following    203 Followers
# Practical ways to use the Claude Agent SDK ๐Ÿ“ฆ Get typed JSON output from agents and bind it directly to your UI components. Structured Output uses `output_format` to receive agent results as typed data conforming to a JSON schema, validated with Zod or Pydantic. ๐Ÿ“Œ Title: Getting Structured Output from Agents ๐Ÿ”— URL: ๐Ÿงฉ Overview Specify a JSON schema in `output_format` and the agent returns structured JSON instead of free text. Type-safe validation is available via Zod (TypeScript) / Pydantic (Python). ๐Ÿ›  How to use it Set `output_format={"type": "json_schema", "schema": your_schema}` in your options. Generate schemas with Pydantic's `.model_json_schema()` or Zod's `z.toJSONSchema()`. Results appear in `ResultMessage.structured_output`. ๐Ÿ— Practical usage - In a recipe app, get web search results as `{name, prep_time_minutes, ingredients[], steps[]}` and bind directly to UI components. - Build a TODO extraction agent that runs Grep + Bash(git blame) autonomously and returns `{todos[{text, file, line, author?, date?}], total_count}`. - Receive feature implementation plans as `{summary, steps[{description, complexity}], risks[]}` for automatic project management tool integration. ๐Ÿ’ก Use cases ๐ŸŽจ Direct data binding to UI components ๐Ÿ“Š Structured analysis report generation ๐Ÿ”ง Automatic data ingestion into project management tools โš ๏ธ Watch out Structured output is incompatible with streaming. JSON results only appear in the final `ResultMessage.structured_output`. Handle `error_max_structured_output_retries` by retrying with simpler prompts or falling back to unstructured output. #ClaudeAgentSDK# #AI#
Show more