Skip to content

Commit 494a92c

Browse files
authored
refactor: Update Task model fields to use protobuf types for statu…s, artifacts, and history. (#819)
This is a rollback of a change made in: #783
1 parent b0ebdaa commit 494a92c

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

src/a2a/server/models.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ def override(func): # noqa: ANN001, ANN201
1111
return func
1212

1313

14+
from a2a.types.a2a_pb2 import Artifact, Message, TaskStatus
15+
16+
1417
try:
1518
from sqlalchemy import JSON, DateTime, Index, LargeBinary, String
1619
from sqlalchemy.orm import (
@@ -48,13 +51,11 @@ class TaskMixin:
4851
last_updated: Mapped[datetime | None] = mapped_column(
4952
DateTime, nullable=True
5053
)
51-
status: Mapped[dict[str, Any] | None] = mapped_column(JSON, nullable=True)
52-
artifacts: Mapped[list[dict[str, Any]] | None] = mapped_column(
53-
JSON, nullable=True
54-
)
55-
history: Mapped[list[dict[str, Any]] | None] = mapped_column(
54+
status: Mapped[TaskStatus] = mapped_column(JSON, nullable=False)
55+
artifacts: Mapped[list[Artifact] | None] = mapped_column(
5656
JSON, nullable=True
5757
)
58+
history: Mapped[list[Message] | None] = mapped_column(JSON, nullable=True)
5859
protocol_version: Mapped[str | None] = mapped_column(
5960
String(16), nullable=True
6061
)

0 commit comments

Comments
 (0)