Architecture
You2AgentAI is designed with a clean separation of concerns between data ingestion, agent processing, and output formatting.
System Layers
1. Ingestion Layer
Responsible for fetching YouTube video metadata and transcripts. Uses the YouTube Data API v3 and handles rate limiting, retry logic, and caching to avoid redundant API calls.
2. Agent Layer
The core of the system. Each agent implements a standard process(input: AgentInput) -> AgentOutput interface. Agents are stateless by design to enable horizontal scaling.
3. Provider Layer
Abstracts LLM API calls. Currently supported providers: OpenAI (GPT-4o, GPT-4o-mini), Anthropic (Claude 3.5 Sonnet, Haiku), and any OpenAI-compatible endpoint.
4. Storage Layer
Handles persistence of results. Supports in-memory (for testing), SQLite, PostgreSQL, and object storage (S3, R2) for large-scale deployments.
Design Principles
- Immutability: Agent inputs and outputs are immutable data classes. No side effects inside agents.
- Provider agnosticism: Swap LLM providers via configuration, not code changes.
- Testability: Every agent can be tested with mock providers and static inputs.
- Observability: Built-in tracing and token usage tracking per agent.