Skip to content

Commit 358dba2

Browse files
fix(agent_templates): preserve BOTH _id (ObjectId) and id (slug) — were distinct, not dup
Pre-merge deep review against live data: the listAgentTemplates item returns a Mongo ObjectId on _id AND a human-readable slug on id. My earlier dedup dropped the slug and made .id return the ObjectId — silent data loss + behavior change. Now expose both: .id = slug (matches the field description + prior runtime), .object_id = ObjectId. Verified live: both populate. mypy==1.13.0 green. Escalation [2] corrected accordingly.
1 parent 4fa5ee3 commit 358dba2

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

src/smallestai/atoms/agent_templates/types/list_agent_templates_agent_templates_response_data_item.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,18 @@
2525

2626

2727
class ListAgentTemplatesAgentTemplatesResponseDataItem(UncheckedBaseModel):
28-
id: typing_extensions.Annotated[
28+
# NOTE: the API returns BOTH `_id` (Mongo ObjectId) and `id` (a human-readable
29+
# slug). Fern aliases `_id` -> `id`, which collides with the real `id`. Until the
30+
# spec disambiguates these (see SDK_ESCALATIONS.log), expose them as distinct
31+
# fields so neither value is lost: `.id` keeps the slug (matches the field's own
32+
# "The ID of the agent template" description and the prior runtime behaviour),
33+
# `.object_id` carries the Mongo ObjectId.
34+
id: typing.Optional[str] = pydantic.Field(default=None)
35+
"""
36+
The ID of the agent template
37+
"""
38+
39+
object_id: typing_extensions.Annotated[
2940
typing.Optional[str],
3041
FieldMetadata(alias="_id"),
3142
pydantic.Field(alias="_id", description="MongoDB ObjectId of the template"),

0 commit comments

Comments
 (0)