a2aproject / a2aproject/a2a-dotnet
Should ITaskManager handlers that are Task-returning Functions use the Async suffix?
- Vorherrschende Sprache
- C#
- Sterne
- 262
- Forks
- 64
- Ø Merge
- 5 T. 2 Std.
- Gemergte PRs (30 T.)
- 31
Beschreibung
A question raised by @darrelmiller in https://github.com/a2aproject/a2a-dotnet/pull/87#discussion_r2223344286
Currently we [have](https://github.com/a2aproject/a2a-dotnet/blob/5c39c64c25d14a49c5c965002c98054f055a3b84/src/A2A/Server/ITaskManager.cs#L17-L49) few handlers that are Task-returning Funcs:
```cs
Func>? OnMessageReceived { get; set; }
Func OnTaskCreated { get; set; }
Func OnTaskCancelled { get; set; }
Func OnTaskUpdated { get; set; }
Func> OnAgentCardQuery { get; set; }
```
The interface also exposes async [methods](https://github.com/a2aproject/a2a-dotnet/blob/5c39c64c25d14a49c5c965002c98054f055a3b84/src/A2A/Server/ITaskManager.cs#L67-L173) that return `Task` directly and use `Async` suffix:
```cs
Task CreateTaskAsync(string? contextId = null, string? taskId = null, CancellationToken cancellationToken = default);
Task ReturnArtifactAsync(string taskId, Artifact artifact, CancellationToken cancellationToken = default);
```
Beitragsleitfaden
Bewertung
Dieses Issue wurde noch nicht bewertet.