[Feat]: Add Ability to Specify Deadlines for Tasks
- Lingua principale
- Shell
- Stelle
- 25.7k
- Fork
- 2.6k
- Merge medio
- 3g 6h
- PR unite (30g)
- 16
Descrizione
### Is your feature request related to a problem? Please describe.
There are certain tasks that are very time-sensitive.
It would be great to have the ability to optionally specify a deadline as a string (ISO 8601) field with the deadline that the server (agent) needs to provide a complete response by. There are certain scenarios where a response from the server is no longer relevant unless it is completed by a specific deadline.
A deadline is an absolute timestamp by which the server must complete the task or stream of tasks.
If this optional field is specified in the request, the server should only accept tasks that it is able to complete fully inside this deadline. If it is a streaming tasks all responses including the final response for that stream needs to be sent to the client before the deadline.
There are many scenarios in the real world where this is relevant and we should update the protocol specification to support this feature.
Servers can use this deadline specified by the clients to:
- reject requests it feels it would not be able to complete by the deadline
- always be aware of how much time it has left to complete the task
- avoid doing work that is expensive and would not finish in time for the client
- prioritize tasks accordingly
- warn about possible SLA violations
- delegate and propagate deadline to downstream agents with a shared deadline context
### Describe the solution you'd like
We can update the `Task` object with a `deadline` field that is a string (ISO 8601)
We can update the `MessageSendConfiguration` object to include the `deadline` field as well in the `message/send` and `message/stream` methods
```typescript
/** Sent by the client to the agent as a request. May create, continue or restart a task. */
export interface MessageSendParams {
/** The message being sent to the server. */
message: Message;
/** Send message configuration. */
configuration?: MessageSendConfiguration;
/** Extension metadata. */
metadata?: {
[key: string]: any;
};
}
/**Configuration for the send message request. */
export interface MessageSendConfiguration {
/** Accepted output modalities by the client. */
acceptedOutputModes: string[];
/** Number of recent messages to be retrieved. */
historyLength?: number;
/** Where the server should send notifications when disconnected. */
pushNotificationConfig?: PushNotificationConfig;
/** If the server should treat the client as a blocking request. */
blocking?: boolean;
/** Deadline to complete the task in UTC **/
deadline?: string;
}
export interface Task {
/** Unique identifier for the task */
id: string;
/** Server-generated id for contextual alignment across interactions */
contextId: string;
/** Current status of the task */
status: TaskStatus;
history?: Message[];
/** Collection of artifacts created by the agent. */
artifacts?: Artifact[];
/** Extension metadata. */
metadata?: {
[key: string]: any;
};
/** Event type */
kind: "task";
/** Deadline to complete the task in UTC **/
deadline?: string;
}
```
### Scenarios
- Servers can reject tasks they are not able to handle within the specified SLA
- Servers can stop working on the tasks an cancel them with a `deadlineExceeded` status
### Describe alternatives you've considered
_No response_
### Additional context
_No response_
### Code of Conduct
- [x] I agree to follow this project's Code of Conduct
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
The issue proposes adding a `deadline` field to the `Task` and `MessageSendConfiguration` interfaces in the A2A protocol. Start by locating the TypeScript definitions for these interfaces, likely in a file like `src/protocol.ts` or similar. Understand how tasks are created and processed. The change involves updating the protocol specification, server-side validation, and potentially adding a new `deadlineExceeded` task status. Check existing tests for task handling to see how to add tests for the new deadline logic.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- typescript
- Ambito
- backend-api-design
- Tipo di issue
- Funzionalità
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Tranquilla
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 45/100