[Feat]: [Feat]: Add metadata parameter to TaskUpdater.update_status method
yokonao opened this issue · 0 comments
yokonao commented
Is your feature request related to a problem? Please describe.
Currently, the TaskUpdater.update_status() method does not allow passing metadata, even though the underlying TaskStatusUpdateEvent type already has a metadata field.
When implementing agents, there are situations where we need to attach additional context or custom data to status updates
(e.g., progress percentages, error codes, or domain-specific information). Without this capability, we have to work around the limitation by using the lower level API EventQueue.enqueue_event.
Describe the solution you'd like
Add an optional metadata parameter to the TaskUpdater.update_status() method:
async def update_status(
self,
state: TaskState,
message: Message | None = None,
final: bool = False,
timestamp: str | None = None,
metadata: dict[str, Any] | None = None, # New parameter
) -> None:The implementation would pass this metadata to the TaskStatusUpdateEvent:
await self.event_queue.enqueue_event(
TaskStatusUpdateEvent(
task_id=self.task_id,
context_id=self.context_id,
final=final,
metadata=metadata, # Pass metadata here
status=TaskStatus(
state=state,
message=message,
timestamp=current_timestamp,
),
)
)This change would:
- Maintain backward compatibility (optional parameter)
- Provide consistency with other TaskUpdater methods
- Enable developers to attach metadata to status updates
Describe alternatives you've considered
N/A
Additional context
N/A
Code of Conduct
- I agree to follow this project's Code of Conduct