Files
roboco/roboco/api/schemas/agents.py
T
Renn F 815f3ebad3 refactor(schemas): migrate Pydantic class Config to ConfigDict
Class-based `Config` is deprecated in Pydantic v2 and removed in v3.
Replace all 11 `class Config: from_attributes = True` blocks across the
API schemas with `model_config = ConfigDict(from_attributes=True)`.
2026-06-03 08:08:46 +02:00

36 lines
699 B
Python

"""
Agents API Schemas
Request/response models for agent endpoints.
"""
from typing import Any, cast
from uuid import UUID
from pydantic import BaseModel, ConfigDict
from roboco.models import AgentRole, Team
class AgentResponse(BaseModel):
"""Response model for agent information."""
id: UUID
name: str
slug: str
role: AgentRole
team: Team | None
model_config = ConfigDict(from_attributes=True)
def agent_to_response(agent: Any) -> AgentResponse:
"""AgentTable → AgentResponse mapper."""
return AgentResponse(
id=cast("UUID", agent.id),
name=agent.name,
slug=agent.slug,
role=agent.role,
team=agent.team,
)