Skip to content

Commit 28e6899

Browse files
committed
use model_copy helper
1 parent bc2ec77 commit 28e6899

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

src/a2a/utils/task.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,6 @@ def apply_history_length(task: Task, history_length: int | None) -> Task:
8989
task.history[-history_length:] if history_length > 0 else []
9090
)
9191
# Create a new task instance with limited history
92-
return Task(
93-
id=task.id,
94-
context_id=task.context_id,
95-
status=task.status,
96-
artifacts=task.artifacts,
97-
history=limited_history,
98-
metadata=task.metadata,
99-
kind=task.kind,
100-
)
92+
return task.model_copy(update={'history': limited_history})
10193

10294
return task

0 commit comments

Comments
 (0)