Skip to main content
Pydantic AI works well when the agent output needs a strict schema for downstream jobs, dashboards, or no-code workflow handoff.

Prerequisites

  • Python 3.10+
  • A Twexapi API key
  • An LLM API key supported by Pydantic AI

Install

Full example

When to use schemas

Use a Pydantic output schema whenever another system will read the result. Good fields include tweet_id, user_id, route_used, has_more, next_cursor, and a normalized rows array.

Handoff checklist

Write actions

For posting, replying, following, blocking, or other side-effecting endpoints, add a schema field such as requires_human_confirmation: bool and stop before calling read_only: false tools.

Environment variables

.env

Package versions