Task

data class Task(val id: String, val contextId: String, val status: TaskStatus, val artifacts: List<Artifact>? = null, val history: List<Message>? = null, val kind: String = "task", val metadata: Metadata? = null)(source)

Represents a single, stateful operation or conversation between a client and an agent.

A task encapsulates the entire interaction related to a specific goal or request. Tasks progress through defined lifecycle states and cannot be restarted once they reach a terminal state (completed, canceled, rejected, or failed).

Constructors

Link copied to clipboard
constructor(id: String, contextId: String, status: TaskStatus, artifacts: List<Artifact>? = null, history: List<Message>? = null, kind: String = "task", metadata: Metadata? = null)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
@SerialName(value = "artifacts")
val artifacts: List<Artifact>?

A collection of artifacts generated by the agent during the execution of the task.

Link copied to clipboard
@SerialName(value = "contextId")
val contextId: String

A server-generated identifier for maintaining context across multiple related tasks or interactions.

Link copied to clipboard
@SerialName(value = "history")
val history: List<Message>?

An array of messages exchanged during the task, representing the conversation history.

Link copied to clipboard
@SerialName(value = "id")
val id: String

A unique identifier for the task, generated by the server for a new task.

Link copied to clipboard
@SerialName(value = "kind")
val kind: String

The type of this object, used as a discriminator. Always 'task' for a Task.

Link copied to clipboard
@SerialName(value = "metadata")
val metadata: Metadata?

Optional metadata for extensions. The key is an extension-specific identifier.

Link copied to clipboard
@SerialName(value = "status")
val status: TaskStatus

The current status of the task, including its state and a descriptive message.