Skip to content

[Feat]: Removing TaskUpdater complete/failed/reject helper functions, or add more functions for the rest of the TaskStatesΒ #172

@njbrake

Description

@njbrake

Is your feature request related to a problem? Please describe.

The API for the TaskUpdater is slightly confusing to me when getting started, because I was seeing some examples making use of the TaskUpdater.complete(message=...) type syntax, while others relied wholly on the TaskUpdater.update_status syntax. I was trying to leverage the TaskState.input_required state, and there was no helper function for that one.

Would you be open to either removing the small helper functions like complete/failed/reject that are only small wrappers around the update_status function? Or, would you be open to adding a few more wrappers to help handling states like input_required?

Describe the solution you'd like

My personal preference would be to remove the helper functions like TaskUpdater.complete Because it seems cleaner to use the update_status function. However, I can understand that maybe having functions like complete may make it easier to read code in some places. If the team wants to keep the helper functions, maybe we could add the missing status helper functions and possibly convert update_status to a private member like _update_status?

Describe alternatives you've considered

There are currently multiple ways to do the same thing, and since both solutions are just a small code difference, aka

updater.update_status(
                TaskState.completed,
                message=new_agent_parts_message(
                    [Part(root=TextPart(text=agent_trace.final_output.result))],
                    task.contextId,
                    task.id,
                ),
                final=True,
            )

vs

updater.complete(
                message=new_agent_parts_message(
                    [Part(root=TextPart(text=agent_trace.final_output.result))],
                    task.contextId,
                    task.id,
                )
            )

It's not clear to me what the added value of the .complete() function is.

Additional context

Found while working on mozilla-ai/any-agent#410

If someone from the google team can provide a πŸ‘ or πŸ‘Ž on my proposal, I'd be happy to help with the implementation if we agree about taking an action.

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions