Skip to content

Python SDK models are not rebuilt on normal import #15

Description

@enguerran-leclerc

Repro

From a fresh install of the SDK, run:

from agent_platform import Client, SessionRequest
from agent_platform.api.agents import list_agents
from agent_platform.models.user_message_event import UserMessageEvent

client = Client(api_key=\"hk-...\")
list_agents.sync(client=client, size=5)
SessionRequest(
    agent=\"h/web\",
    messages=[UserMessageEvent(message=\"Open https://example.com\")],
)

Actual

Pydantic raises errors such as:

PydanticUserError: `Agent` is not fully defined; you should define `Browser`, then call `Agent.model_rebuild()`.
PydanticUserError: `SessionRequest` is not fully defined; you should define `Agent`, then call `SessionRequest.model_rebuild()`.

The integration test fixtures currently rebuild all generated models as a workaround, but normal SDK users do not get that setup.

Expected

Importing agent_platform should leave generated Pydantic models ready for normal instantiation and API response parsing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions