Skip to content

[Task]: Consider refining/removing ClientTaskManager #734

@ishymko

Description

@ishymko

Currently ClientTaskManager tries to replicate server logic of maintaining task state on the client applying TaskXxxUpdateEvent's.

This logic already diverges from server when it comes to task history: on the client current status update message is added to the history:

if event.status.message:
if not task.history:
task.history = [event.status.message]
else:
task.history.append(event.status.message)

while on the server it only contains messages from previous updates:

if task.status.message:
if not task.history:
task.history = [task.status.message]
else:
task.history.append(task.status.message)
if event.metadata:
if not task.metadata:
task.metadata = {}
task.metadata.update(event.metadata)
task.status = event.status

Having Client returning Task object assembled using this logic can be confusing as it can be different from the actual server-side state. Especially with 1.0 which specifies history behavior to be partially server-side defined:

The Task History field contains Messages exchanged during task execution. However, not all Messages are guaranteed to be persisted in the Task history; for example, transient informational messages may not be stored. Messages exchanged prior to task creation may not be stored in Task history. The agent is responsible to determine which Messages are persisted in the Task History.

(3.7 Messages and Artifacts)

In addition, relying heavily on task history is rather a leftover from earlier integrations which used task history to stream the actual LLM response (which should be returned as an artifact instead).

Alternative proposal is to create something like ArtifactsAgregator.from_stream(iterator from send_message) as a side utility to interpret artifact append flag properly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions