# fasta2a

### Storage

**Bases:** `ABC`, `Generic[ContextT]`

A storage to retrieve and save tasks, as well as retrieve and save context.

The storage serves two purposes:

1.  Task storage: Stores tasks in A2A protocol format with their status, artifacts, and message history
2.  Context storage: Stores conversation context in a format optimized for the specific agent implementation

#### Methods

##### load\_task

`@abstractmethod`

`@async`

```python
def load_task(task_id: str, history_length: int | None = None) -> Task | None
```

Load a task from storage.

If the task is not found, return None.

###### Returns

`Task` | [`None`](https://docs.python.org/3/library/constants.html#None)

##### submit\_task

`@abstractmethod`

`@async`

```python
def submit_task(context_id: str, message: Message) -> Task
```

Submit a task to storage.

###### Returns

`Task`

##### update\_task

`@abstractmethod`

`@async`

```python
def update_task(
    task_id: str,
    state: TaskState,
    new_artifacts: list[Artifact] | None = None,
    new_messages: list[Message] | None = None,
) -> Task
```

Update the state of a task. Appends artifacts and messages, if specified.

###### Returns

`Task`

##### load\_context

`@abstractmethod`

`@async`

```python
def load_context(context_id: str) -> ContextT | None
```

Retrieve the stored context given the `context_id`.

###### Returns

`ContextT` | [`None`](https://docs.python.org/3/library/constants.html#None)

##### update\_context

`@abstractmethod`

`@async`

```python
def update_context(context_id: str, context: ContextT) -> None
```

Updates the context for a `context_id`.

Implementing agent can decide what to store in context.

###### Returns

[`None`](https://docs.python.org/3/library/constants.html#None)

### Broker

**Bases:** `ABC`

The broker class is in charge of scheduling the tasks.

The HTTP server uses the broker to schedule tasks.

The simple implementation is the `InMemoryBroker`, which is the broker that runs the tasks in the same process as the HTTP server. That said, this class can be extended to support remote workers.

#### Methods

##### run\_task

`@abstractmethod`

`@async`

```python
def run_task(params: TaskSendParams) -> None
```

Send a task to be executed by the worker.

###### Returns

[`None`](https://docs.python.org/3/library/constants.html#None)

##### cancel\_task

`@abstractmethod`

`@async`

```python
def cancel_task(params: TaskIdParams) -> None
```

Cancel a task.

###### Returns

[`None`](https://docs.python.org/3/library/constants.html#None)

##### receive\_task\_operations

`@abstractmethod`

```python
def receive_task_operations() -> AsyncIterator[TaskOperation]
```

Receive task operations from the broker.

On a multi-worker setup, the broker will need to round-robin the task operations between the workers.

###### Returns

[`AsyncIterator`](https://docs.python.org/3/library/typing.html#typing.AsyncIterator)\[`TaskOperation`\]

### Worker

**Bases:** `ABC`, `Generic[ContextT]`

A worker is responsible for executing tasks.

#### Methods

##### run

`@async`

```python
def run() -> AsyncIterator[None]
```

Run the worker.

It connects to the broker, and it makes itself available to receive commands.

###### Returns

[`AsyncIterator`](https://docs.python.org/3/library/typing.html#typing.AsyncIterator)\[[`None`](https://docs.python.org/3/library/constants.html#None)\]

### FastA2A

**Bases:** `Starlette`

The main class for the FastA2A library.

### Skill

**Bases:** [`TypedDict`](https://docs.python.org/3/library/typing.html#typing.TypedDict)

Skills are a unit of capability that an agent can perform.

#### Attributes

##### id

A unique identifier for the skill.

**Type:** [`str`](https://docs.python.org/3/library/stdtypes.html#str)

##### name

Human readable name of the skill.

**Type:** [`str`](https://docs.python.org/3/library/stdtypes.html#str)

##### description

A human-readable description of the skill.

It will be used by the client or a human as a hint to understand the skill.

**Type:** [`str`](https://docs.python.org/3/library/stdtypes.html#str)

##### tags

Set of tag-words describing classes of capabilities for this specific skill.

Examples: "cooking", "customer support", "billing".

**Type:** [`list`](https://docs.python.org/3/glossary.html#term-list)\[[`str`](https://docs.python.org/3/library/stdtypes.html#str)\]

##### examples

The set of example scenarios that the skill can perform.

Will be used by the client as a hint to understand how the skill can be used. (e.g. "I need a recipe for bread")

**Type:** [`NotRequired`](https://docs.python.org/3/library/typing.html#typing.NotRequired)\[[`list`](https://docs.python.org/3/glossary.html#term-list)\[[`str`](https://docs.python.org/3/library/stdtypes.html#str)\]\]

##### input\_modes

Supported mime types for input data.

**Type:** [`list`](https://docs.python.org/3/glossary.html#term-list)\[[`str`](https://docs.python.org/3/library/stdtypes.html#str)\]

##### output\_modes

Supported mime types for output data.

**Type:** [`list`](https://docs.python.org/3/glossary.html#term-list)\[[`str`](https://docs.python.org/3/library/stdtypes.html#str)\]

This module contains the schema for the agent card.

### AgentCard

**Bases:** [`TypedDict`](https://docs.python.org/3/library/typing.html#typing.TypedDict)

The card that describes an agent.

#### Attributes

##### name

Human readable name of the agent e.g. "Recipe Agent".

**Type:** [`str`](https://docs.python.org/3/library/stdtypes.html#str)

##### description

A human-readable description of the agent.

Used to assist users and other agents in understanding what the agent can do. (e.g. "Agent that helps users with recipes and cooking.")

**Type:** [`str`](https://docs.python.org/3/library/stdtypes.html#str)

##### url

A URL to the address the agent is hosted at.

**Type:** [`str`](https://docs.python.org/3/library/stdtypes.html#str)

##### version

The version of the agent - format is up to the provider. (e.g. "1.0.0")

**Type:** [`str`](https://docs.python.org/3/library/stdtypes.html#str)

##### protocol\_version

The version of the A2A protocol this agent supports.

**Type:** [`str`](https://docs.python.org/3/library/stdtypes.html#str)

##### provider

The service provider of the agent.

**Type:** [`NotRequired`](https://docs.python.org/3/library/typing.html#typing.NotRequired)\[`AgentProvider`\]

##### documentation\_url

A URL to documentation for the agent.

**Type:** [`NotRequired`](https://docs.python.org/3/library/typing.html#typing.NotRequired)\[[`str`](https://docs.python.org/3/library/stdtypes.html#str)\]

##### icon\_url

A URL to an icon for the agent.

**Type:** [`NotRequired`](https://docs.python.org/3/library/typing.html#typing.NotRequired)\[[`str`](https://docs.python.org/3/library/stdtypes.html#str)\]

##### preferred\_transport

The transport of the preferred endpoint. If empty, defaults to JSONRPC.

**Type:** [`NotRequired`](https://docs.python.org/3/library/typing.html#typing.NotRequired)\[[`str`](https://docs.python.org/3/library/stdtypes.html#str)\]

##### additional\_interfaces

Announcement of additional supported transports.

**Type:** [`NotRequired`](https://docs.python.org/3/library/typing.html#typing.NotRequired)\[[`list`](https://docs.python.org/3/glossary.html#term-list)\[`AgentInterface`\]\]

##### capabilities

The capabilities of the agent.

**Type:** `AgentCapabilities`

##### security

Security requirements for contacting the agent.

**Type:** [`NotRequired`](https://docs.python.org/3/library/typing.html#typing.NotRequired)\[[`list`](https://docs.python.org/3/glossary.html#term-list)\[[`dict`](https://docs.python.org/3/reference/expressions.html#dict)\[[`str`](https://docs.python.org/3/library/stdtypes.html#str), [`list`](https://docs.python.org/3/glossary.html#term-list)\[[`str`](https://docs.python.org/3/library/stdtypes.html#str)\]\]\]\]

##### security\_schemes

Security scheme definitions.

**Type:** [`NotRequired`](https://docs.python.org/3/library/typing.html#typing.NotRequired)\[[`dict`](https://docs.python.org/3/reference/expressions.html#dict)\[[`str`](https://docs.python.org/3/library/stdtypes.html#str), `SecurityScheme`\]\]

##### default\_input\_modes

Supported mime types for input data.

**Type:** [`list`](https://docs.python.org/3/glossary.html#term-list)\[[`str`](https://docs.python.org/3/library/stdtypes.html#str)\]

##### default\_output\_modes

Supported mime types for output data.

**Type:** [`list`](https://docs.python.org/3/glossary.html#term-list)\[[`str`](https://docs.python.org/3/library/stdtypes.html#str)\]

##### skills

The set of skills, or distinct capabilities, that the agent can perform.

**Type:** [`list`](https://docs.python.org/3/glossary.html#term-list)\[`Skill`\]

### AgentProvider

**Bases:** [`TypedDict`](https://docs.python.org/3/library/typing.html#typing.TypedDict)

The service provider of the agent.

#### Attributes

##### organization

The name of the agent provider's organization.

**Type:** [`str`](https://docs.python.org/3/library/stdtypes.html#str)

##### url

A URL for the agent provider's website or relevant documentation.

**Type:** [`str`](https://docs.python.org/3/library/stdtypes.html#str)

### AgentCapabilities

**Bases:** [`TypedDict`](https://docs.python.org/3/library/typing.html#typing.TypedDict)

The capabilities of the agent.

#### Attributes

##### streaming

Whether the agent supports streaming.

**Type:** [`NotRequired`](https://docs.python.org/3/library/typing.html#typing.NotRequired)\[[`bool`](https://docs.python.org/3/library/functions.html#bool)\]

##### push\_notifications

Whether the agent can notify updates to client.

**Type:** [`NotRequired`](https://docs.python.org/3/library/typing.html#typing.NotRequired)\[[`bool`](https://docs.python.org/3/library/functions.html#bool)\]

##### state\_transition\_history

Whether the agent exposes status change history for tasks.

**Type:** [`NotRequired`](https://docs.python.org/3/library/typing.html#typing.NotRequired)\[[`bool`](https://docs.python.org/3/library/functions.html#bool)\]

### HttpSecurityScheme

**Bases:** [`TypedDict`](https://docs.python.org/3/library/typing.html#typing.TypedDict)

HTTP security scheme.

#### Attributes

##### type

The type of the security scheme. Must be 'http'.

**Type:** [`Literal`](https://docs.python.org/3/library/typing.html#typing.Literal)\['http'\]

##### scheme

The name of the HTTP Authorization scheme.

**Type:** [`str`](https://docs.python.org/3/library/stdtypes.html#str)

##### bearer\_format

A hint to the client to identify how the bearer token is formatted.

**Type:** [`NotRequired`](https://docs.python.org/3/library/typing.html#typing.NotRequired)\[[`str`](https://docs.python.org/3/library/stdtypes.html#str)\]

##### description

Description of this security scheme.

**Type:** [`NotRequired`](https://docs.python.org/3/library/typing.html#typing.NotRequired)\[[`str`](https://docs.python.org/3/library/stdtypes.html#str)\]

### ApiKeySecurityScheme

**Bases:** [`TypedDict`](https://docs.python.org/3/library/typing.html#typing.TypedDict)

API Key security scheme.

#### Attributes

##### type

The type of the security scheme. Must be 'apiKey'.

**Type:** [`Literal`](https://docs.python.org/3/library/typing.html#typing.Literal)\['apiKey'\]

##### name

The name of the header, query or cookie parameter to be used.

**Type:** [`str`](https://docs.python.org/3/library/stdtypes.html#str)

##### in\_

The location of the API key.

**Type:** [`Literal`](https://docs.python.org/3/library/typing.html#typing.Literal)\['query', 'header', 'cookie'\]

##### description

Description of this security scheme.

**Type:** [`NotRequired`](https://docs.python.org/3/library/typing.html#typing.NotRequired)\[[`str`](https://docs.python.org/3/library/stdtypes.html#str)\]

### OAuth2SecurityScheme

**Bases:** [`TypedDict`](https://docs.python.org/3/library/typing.html#typing.TypedDict)

OAuth2 security scheme.

#### Attributes

##### type

The type of the security scheme. Must be 'oauth2'.

**Type:** [`Literal`](https://docs.python.org/3/library/typing.html#typing.Literal)\['oauth2'\]

##### flows

An object containing configuration information for the flow types supported.

**Type:** [`dict`](https://docs.python.org/3/reference/expressions.html#dict)\[[`str`](https://docs.python.org/3/library/stdtypes.html#str), [`Any`](https://docs.python.org/3/library/typing.html#typing.Any)\]

##### description

Description of this security scheme.

**Type:** [`NotRequired`](https://docs.python.org/3/library/typing.html#typing.NotRequired)\[[`str`](https://docs.python.org/3/library/stdtypes.html#str)\]

### OpenIdConnectSecurityScheme

**Bases:** [`TypedDict`](https://docs.python.org/3/library/typing.html#typing.TypedDict)

OpenID Connect security scheme.

#### Attributes

##### type

The type of the security scheme. Must be 'openIdConnect'.

**Type:** [`Literal`](https://docs.python.org/3/library/typing.html#typing.Literal)\['openIdConnect'\]

##### open\_id\_connect\_url

OpenId Connect URL to discover OAuth2 configuration values.

**Type:** [`str`](https://docs.python.org/3/library/stdtypes.html#str)

##### description

Description of this security scheme.

**Type:** [`NotRequired`](https://docs.python.org/3/library/typing.html#typing.NotRequired)\[[`str`](https://docs.python.org/3/library/stdtypes.html#str)\]

### AgentInterface

**Bases:** [`TypedDict`](https://docs.python.org/3/library/typing.html#typing.TypedDict)

An interface that the agent supports.

#### Attributes

##### transport

The transport protocol (e.g., 'jsonrpc', 'websocket').

**Type:** [`str`](https://docs.python.org/3/library/stdtypes.html#str)

##### url

The URL endpoint for this transport.

**Type:** [`str`](https://docs.python.org/3/library/stdtypes.html#str)

##### description

Description of this interface.

**Type:** [`NotRequired`](https://docs.python.org/3/library/typing.html#typing.NotRequired)\[[`str`](https://docs.python.org/3/library/stdtypes.html#str)\]

### AgentExtension

**Bases:** [`TypedDict`](https://docs.python.org/3/library/typing.html#typing.TypedDict)

A declaration of an extension supported by an Agent.

#### Attributes

##### uri

The URI of the extension.

**Type:** [`str`](https://docs.python.org/3/library/stdtypes.html#str)

##### description

A description of how this agent uses this extension.

**Type:** [`NotRequired`](https://docs.python.org/3/library/typing.html#typing.NotRequired)\[[`str`](https://docs.python.org/3/library/stdtypes.html#str)\]

##### required

Whether the client must follow specific requirements of the extension.

**Type:** [`NotRequired`](https://docs.python.org/3/library/typing.html#typing.NotRequired)\[[`bool`](https://docs.python.org/3/library/functions.html#bool)\]

##### params

Optional configuration for the extension.

**Type:** [`NotRequired`](https://docs.python.org/3/library/typing.html#typing.NotRequired)\[[`dict`](https://docs.python.org/3/reference/expressions.html#dict)\[[`str`](https://docs.python.org/3/library/stdtypes.html#str), [`Any`](https://docs.python.org/3/library/typing.html#typing.Any)\]\]

### Skill

**Bases:** [`TypedDict`](https://docs.python.org/3/library/typing.html#typing.TypedDict)

Skills are a unit of capability that an agent can perform.

#### Attributes

##### id

A unique identifier for the skill.

**Type:** [`str`](https://docs.python.org/3/library/stdtypes.html#str)

##### name

Human readable name of the skill.

**Type:** [`str`](https://docs.python.org/3/library/stdtypes.html#str)

##### description

A human-readable description of the skill.

It will be used by the client or a human as a hint to understand the skill.

**Type:** [`str`](https://docs.python.org/3/library/stdtypes.html#str)

##### tags

Set of tag-words describing classes of capabilities for this specific skill.

Examples: "cooking", "customer support", "billing".

**Type:** [`list`](https://docs.python.org/3/glossary.html#term-list)\[[`str`](https://docs.python.org/3/library/stdtypes.html#str)\]

##### examples

The set of example scenarios that the skill can perform.

Will be used by the client as a hint to understand how the skill can be used. (e.g. "I need a recipe for bread")

**Type:** [`NotRequired`](https://docs.python.org/3/library/typing.html#typing.NotRequired)\[[`list`](https://docs.python.org/3/glossary.html#term-list)\[[`str`](https://docs.python.org/3/library/stdtypes.html#str)\]\]

##### input\_modes

Supported mime types for input data.

**Type:** [`list`](https://docs.python.org/3/glossary.html#term-list)\[[`str`](https://docs.python.org/3/library/stdtypes.html#str)\]

##### output\_modes

Supported mime types for output data.

**Type:** [`list`](https://docs.python.org/3/glossary.html#term-list)\[[`str`](https://docs.python.org/3/library/stdtypes.html#str)\]

### Artifact

**Bases:** [`TypedDict`](https://docs.python.org/3/library/typing.html#typing.TypedDict)

Agents generate Artifacts as an end result of a Task.

Artifacts are immutable, can be named, and can have multiple parts. A streaming response can append parts to existing Artifacts.

A single Task can generate many Artifacts. For example, "create a webpage" could create separate HTML and image Artifacts.

#### Attributes

##### artifact\_id

Unique identifier for the artifact.

**Type:** [`str`](https://docs.python.org/3/library/stdtypes.html#str)

##### name

The name of the artifact.

**Type:** [`NotRequired`](https://docs.python.org/3/library/typing.html#typing.NotRequired)\[[`str`](https://docs.python.org/3/library/stdtypes.html#str)\]

##### description

A description of the artifact.

**Type:** [`NotRequired`](https://docs.python.org/3/library/typing.html#typing.NotRequired)\[[`str`](https://docs.python.org/3/library/stdtypes.html#str)\]

##### parts

The parts that make up the artifact.

**Type:** [`list`](https://docs.python.org/3/glossary.html#term-list)\[`Part`\]

##### metadata

Metadata about the artifact.

**Type:** [`NotRequired`](https://docs.python.org/3/library/typing.html#typing.NotRequired)\[[`dict`](https://docs.python.org/3/reference/expressions.html#dict)\[[`str`](https://docs.python.org/3/library/stdtypes.html#str), [`Any`](https://docs.python.org/3/library/typing.html#typing.Any)\]\]

##### extensions

Array of extensions.

**Type:** [`NotRequired`](https://docs.python.org/3/library/typing.html#typing.NotRequired)\[[`list`](https://docs.python.org/3/glossary.html#term-list)\[[`str`](https://docs.python.org/3/library/stdtypes.html#str)\]\]

##### append

Whether to append this artifact to an existing one.

**Type:** [`NotRequired`](https://docs.python.org/3/library/typing.html#typing.NotRequired)\[[`bool`](https://docs.python.org/3/library/functions.html#bool)\]

##### last\_chunk

Whether this is the last chunk of the artifact.

**Type:** [`NotRequired`](https://docs.python.org/3/library/typing.html#typing.NotRequired)\[[`bool`](https://docs.python.org/3/library/functions.html#bool)\]

### PushNotificationConfig

**Bases:** [`TypedDict`](https://docs.python.org/3/library/typing.html#typing.TypedDict)

Configuration for push notifications.

A2A supports a secure notification mechanism whereby an agent can notify a client of an update outside a connected session via a PushNotificationService. Within and across enterprises, it is critical that the agent verifies the identity of the notification service, authenticates itself with the service, and presents an identifier that ties the notification to the executing Task.

The target server of the PushNotificationService should be considered a separate service, and is not guaranteed (or even expected) to be the client directly. This PushNotificationService is responsible for authenticating and authorizing the agent and for proxying the verified notification to the appropriate endpoint (which could be anything from a pub/sub queue, to an email inbox or other service, etc.).

For contrived scenarios with isolated client-agent pairs (e.g. local service mesh in a contained VPC, etc.) or isolated environments without enterprise security concerns, the client may choose to simply open a port and act as its own PushNotificationService. Any enterprise implementation will likely have a centralized service that authenticates the remote agents with trusted notification credentials and can handle online/offline scenarios. (This should be thought of similarly to a mobile Push Notification Service).

#### Attributes

##### id

Server-assigned identifier.

**Type:** [`NotRequired`](https://docs.python.org/3/library/typing.html#typing.NotRequired)\[[`str`](https://docs.python.org/3/library/stdtypes.html#str)\]

##### url

The URL to send push notifications to.

**Type:** [`str`](https://docs.python.org/3/library/stdtypes.html#str)

##### token

Token unique to this task/session.

**Type:** [`NotRequired`](https://docs.python.org/3/library/typing.html#typing.NotRequired)\[[`str`](https://docs.python.org/3/library/stdtypes.html#str)\]

##### authentication

Authentication details for push notifications.

**Type:** [`NotRequired`](https://docs.python.org/3/library/typing.html#typing.NotRequired)\[`SecurityScheme`\]

### TaskPushNotificationConfig

**Bases:** [`TypedDict`](https://docs.python.org/3/library/typing.html#typing.TypedDict)

Configuration for task push notifications.

#### Attributes

##### id

The task id.

**Type:** [`str`](https://docs.python.org/3/library/stdtypes.html#str)

##### push\_notification\_config

The push notification configuration.

**Type:** `PushNotificationConfig`

### Message

**Bases:** [`TypedDict`](https://docs.python.org/3/library/typing.html#typing.TypedDict)

A Message contains any content that is not an Artifact.

This can include things like agent thoughts, user context, instructions, errors, status, or metadata.

All content from a client comes in the form of a Message. Agents send Messages to communicate status or to provide instructions (whereas generated results are sent as Artifacts).

A Message can have multiple parts to denote different pieces of content. For example, a user request could include a textual description from a user and then multiple files used as context from the client.

#### Attributes

##### role

The role of the message.

**Type:** [`Literal`](https://docs.python.org/3/library/typing.html#typing.Literal)\['user', 'agent'\]

##### parts

The parts of the message.

**Type:** [`list`](https://docs.python.org/3/glossary.html#term-list)\[`Part`\]

##### kind

Event type.

**Type:** [`Literal`](https://docs.python.org/3/library/typing.html#typing.Literal)\['message'\]

##### metadata

Metadata about the message.

**Type:** [`NotRequired`](https://docs.python.org/3/library/typing.html#typing.NotRequired)\[[`dict`](https://docs.python.org/3/reference/expressions.html#dict)\[[`str`](https://docs.python.org/3/library/stdtypes.html#str), [`Any`](https://docs.python.org/3/library/typing.html#typing.Any)\]\]

##### message\_id

Identifier created by the message creator.

**Type:** [`str`](https://docs.python.org/3/library/stdtypes.html#str)

##### context\_id

The context the message is associated with.

**Type:** [`NotRequired`](https://docs.python.org/3/library/typing.html#typing.NotRequired)\[[`str`](https://docs.python.org/3/library/stdtypes.html#str)\]

##### task\_id

Identifier of task the message is related to.

**Type:** [`NotRequired`](https://docs.python.org/3/library/typing.html#typing.NotRequired)\[[`str`](https://docs.python.org/3/library/stdtypes.html#str)\]

##### reference\_task\_ids

Array of task IDs this message references.

**Type:** [`NotRequired`](https://docs.python.org/3/library/typing.html#typing.NotRequired)\[[`list`](https://docs.python.org/3/glossary.html#term-list)\[[`str`](https://docs.python.org/3/library/stdtypes.html#str)\]\]

##### extensions

Array of extensions.

**Type:** [`NotRequired`](https://docs.python.org/3/library/typing.html#typing.NotRequired)\[[`list`](https://docs.python.org/3/glossary.html#term-list)\[[`str`](https://docs.python.org/3/library/stdtypes.html#str)\]\]

### TextPart

**Bases:** `_BasePart`

A part that contains text.

#### Attributes

##### kind

The kind of the part.

**Type:** [`Literal`](https://docs.python.org/3/library/typing.html#typing.Literal)\['text'\]

##### text

The text of the part.

**Type:** [`str`](https://docs.python.org/3/library/stdtypes.html#str)

### FileWithBytes

**Bases:** [`TypedDict`](https://docs.python.org/3/library/typing.html#typing.TypedDict)

File with base64 encoded data.

#### Attributes

##### bytes

The base64 encoded content of the file.

**Type:** [`str`](https://docs.python.org/3/library/stdtypes.html#str)

##### mime\_type

Optional mime type for the file.

**Type:** [`NotRequired`](https://docs.python.org/3/library/typing.html#typing.NotRequired)\[[`str`](https://docs.python.org/3/library/stdtypes.html#str)\]

### FileWithUri

**Bases:** [`TypedDict`](https://docs.python.org/3/library/typing.html#typing.TypedDict)

File with URI reference.

#### Attributes

##### uri

The URI of the file.

**Type:** [`str`](https://docs.python.org/3/library/stdtypes.html#str)

##### mime\_type

The mime type of the file.

**Type:** [`NotRequired`](https://docs.python.org/3/library/typing.html#typing.NotRequired)\[[`str`](https://docs.python.org/3/library/stdtypes.html#str)\]

### FilePart

**Bases:** `_BasePart`

A part that contains a file.

#### Attributes

##### kind

The kind of the part.

**Type:** [`Literal`](https://docs.python.org/3/library/typing.html#typing.Literal)\['file'\]

##### file

The file content - either bytes or URI.

**Type:** `FileWithBytes` | `FileWithUri`

### DataPart

**Bases:** `_BasePart`

A part that contains structured data.

#### Attributes

##### kind

The kind of the part.

**Type:** [`Literal`](https://docs.python.org/3/library/typing.html#typing.Literal)\['data'\]

##### data

The data of the part.

**Type:** [`dict`](https://docs.python.org/3/reference/expressions.html#dict)\[[`str`](https://docs.python.org/3/library/stdtypes.html#str), [`Any`](https://docs.python.org/3/library/typing.html#typing.Any)\]

### TaskStatus

**Bases:** [`TypedDict`](https://docs.python.org/3/library/typing.html#typing.TypedDict)

Status and accompanying message for a task.

#### Attributes

##### state

The current state of the task.

**Type:** `TaskState`

##### message

Additional status updates for client.

**Type:** [`NotRequired`](https://docs.python.org/3/library/typing.html#typing.NotRequired)\[`Message`\]

##### timestamp

ISO datetime value of when the status was updated.

**Type:** [`NotRequired`](https://docs.python.org/3/library/typing.html#typing.NotRequired)\[[`str`](https://docs.python.org/3/library/stdtypes.html#str)\]

### Task

**Bases:** [`TypedDict`](https://docs.python.org/3/library/typing.html#typing.TypedDict)

A Task is a stateful entity that allows Clients and Remote Agents to achieve a specific outcome.

Clients and Remote Agents exchange Messages within a Task. Remote Agents generate results as Artifacts. A Task is always created by a Client and the status is always determined by the Remote Agent.

#### Attributes

##### id

Unique identifier for the task.

**Type:** [`str`](https://docs.python.org/3/library/stdtypes.html#str)

##### context\_id

The context the task is associated with.

**Type:** [`str`](https://docs.python.org/3/library/stdtypes.html#str)

##### kind

Event type.

**Type:** [`Literal`](https://docs.python.org/3/library/typing.html#typing.Literal)\['task'\]

##### status

Current status of the task.

**Type:** `TaskStatus`

##### history

Optional history of messages.

**Type:** [`NotRequired`](https://docs.python.org/3/library/typing.html#typing.NotRequired)\[[`list`](https://docs.python.org/3/glossary.html#term-list)\[`Message`\]\]

##### artifacts

Collection of artifacts created by the agent.

**Type:** [`NotRequired`](https://docs.python.org/3/library/typing.html#typing.NotRequired)\[[`list`](https://docs.python.org/3/glossary.html#term-list)\[`Artifact`\]\]

##### metadata

Extension metadata.

**Type:** [`NotRequired`](https://docs.python.org/3/library/typing.html#typing.NotRequired)\[[`dict`](https://docs.python.org/3/reference/expressions.html#dict)\[[`str`](https://docs.python.org/3/library/stdtypes.html#str), [`Any`](https://docs.python.org/3/library/typing.html#typing.Any)\]\]

### TaskStatusUpdateEvent

**Bases:** [`TypedDict`](https://docs.python.org/3/library/typing.html#typing.TypedDict)

Sent by server during message/stream requests.

#### Attributes

##### task\_id

The id of the task.

**Type:** [`str`](https://docs.python.org/3/library/stdtypes.html#str)

##### context\_id

The context the task is associated with.

**Type:** [`str`](https://docs.python.org/3/library/stdtypes.html#str)

##### kind

Event type.

**Type:** [`Literal`](https://docs.python.org/3/library/typing.html#typing.Literal)\['status-update'\]

##### status

The status of the task.

**Type:** `TaskStatus`

##### final

Indicates the end of the event stream.

**Type:** [`bool`](https://docs.python.org/3/library/functions.html#bool)

##### metadata

Extension metadata.

**Type:** [`NotRequired`](https://docs.python.org/3/library/typing.html#typing.NotRequired)\[[`dict`](https://docs.python.org/3/reference/expressions.html#dict)\[[`str`](https://docs.python.org/3/library/stdtypes.html#str), [`Any`](https://docs.python.org/3/library/typing.html#typing.Any)\]\]

### TaskArtifactUpdateEvent

**Bases:** [`TypedDict`](https://docs.python.org/3/library/typing.html#typing.TypedDict)

Sent by server during message/stream requests.

#### Attributes

##### task\_id

The id of the task.

**Type:** [`str`](https://docs.python.org/3/library/stdtypes.html#str)

##### context\_id

The context the task is associated with.

**Type:** [`str`](https://docs.python.org/3/library/stdtypes.html#str)

##### kind

Event type identification.

**Type:** [`Literal`](https://docs.python.org/3/library/typing.html#typing.Literal)\['artifact-update'\]

##### artifact

The artifact that was updated.

**Type:** `Artifact`

##### append

Whether to append to existing artifact (true) or replace (false).

**Type:** [`NotRequired`](https://docs.python.org/3/library/typing.html#typing.NotRequired)\[[`bool`](https://docs.python.org/3/library/functions.html#bool)\]

##### last\_chunk

Indicates this is the final chunk of the artifact.

**Type:** [`NotRequired`](https://docs.python.org/3/library/typing.html#typing.NotRequired)\[[`bool`](https://docs.python.org/3/library/functions.html#bool)\]

##### metadata

Extension metadata.

**Type:** [`NotRequired`](https://docs.python.org/3/library/typing.html#typing.NotRequired)\[[`dict`](https://docs.python.org/3/reference/expressions.html#dict)\[[`str`](https://docs.python.org/3/library/stdtypes.html#str), [`Any`](https://docs.python.org/3/library/typing.html#typing.Any)\]\]

### TaskIdParams

**Bases:** [`TypedDict`](https://docs.python.org/3/library/typing.html#typing.TypedDict)

Parameters for a task id.

#### Attributes

##### id

The unique identifier for the task.

**Type:** [`str`](https://docs.python.org/3/library/stdtypes.html#str)

##### metadata

Optional metadata associated with the request.

**Type:** [`NotRequired`](https://docs.python.org/3/library/typing.html#typing.NotRequired)\[[`dict`](https://docs.python.org/3/reference/expressions.html#dict)\[[`str`](https://docs.python.org/3/library/stdtypes.html#str), [`Any`](https://docs.python.org/3/library/typing.html#typing.Any)\]\]

### TaskQueryParams

**Bases:** `TaskIdParams`

Query parameters for a task.

#### Attributes

##### history\_length

Number of recent messages to be retrieved.

**Type:** [`NotRequired`](https://docs.python.org/3/library/typing.html#typing.NotRequired)\[[`int`](https://docs.python.org/3/library/functions.html#int)\]

### MessageSendConfiguration

**Bases:** [`TypedDict`](https://docs.python.org/3/library/typing.html#typing.TypedDict)

Configuration for the send message request.

#### Attributes

##### accepted\_output\_modes

Accepted output modalities by the client.

**Type:** [`list`](https://docs.python.org/3/glossary.html#term-list)\[[`str`](https://docs.python.org/3/library/stdtypes.html#str)\]

##### blocking

If the server should treat the client as a blocking request.

**Type:** [`NotRequired`](https://docs.python.org/3/library/typing.html#typing.NotRequired)\[[`bool`](https://docs.python.org/3/library/functions.html#bool)\]

##### history\_length

Number of recent messages to be retrieved.

**Type:** [`NotRequired`](https://docs.python.org/3/library/typing.html#typing.NotRequired)\[[`int`](https://docs.python.org/3/library/functions.html#int)\]

##### push\_notification\_config

Where the server should send notifications when disconnected.

**Type:** [`NotRequired`](https://docs.python.org/3/library/typing.html#typing.NotRequired)\[`PushNotificationConfig`\]

### MessageSendParams

**Bases:** [`TypedDict`](https://docs.python.org/3/library/typing.html#typing.TypedDict)

Parameters for message/send method.

#### Attributes

##### configuration

Send message configuration.

**Type:** [`NotRequired`](https://docs.python.org/3/library/typing.html#typing.NotRequired)\[`MessageSendConfiguration`\]

##### message

The message being sent to the server.

**Type:** `Message`

##### metadata

Extension metadata.

**Type:** [`NotRequired`](https://docs.python.org/3/library/typing.html#typing.NotRequired)\[[`dict`](https://docs.python.org/3/reference/expressions.html#dict)\[[`str`](https://docs.python.org/3/library/stdtypes.html#str), [`Any`](https://docs.python.org/3/library/typing.html#typing.Any)\]\]

### TaskSendParams

**Bases:** [`TypedDict`](https://docs.python.org/3/library/typing.html#typing.TypedDict)

Internal parameters for task execution within the framework.

Note: This is not part of the A2A protocol - it's used internally for broker/worker communication.

#### Attributes

##### id

The id of the task.

**Type:** [`str`](https://docs.python.org/3/library/stdtypes.html#str)

##### context\_id

The context id for the task.

**Type:** [`str`](https://docs.python.org/3/library/stdtypes.html#str)

##### message

The message to process.

**Type:** `Message`

##### history\_length

Number of recent messages to be retrieved.

**Type:** [`NotRequired`](https://docs.python.org/3/library/typing.html#typing.NotRequired)\[[`int`](https://docs.python.org/3/library/functions.html#int)\]

##### metadata

Extension metadata.

**Type:** [`NotRequired`](https://docs.python.org/3/library/typing.html#typing.NotRequired)\[[`dict`](https://docs.python.org/3/reference/expressions.html#dict)\[[`str`](https://docs.python.org/3/library/stdtypes.html#str), [`Any`](https://docs.python.org/3/library/typing.html#typing.Any)\]\]

### ListTaskPushNotificationConfigParams

**Bases:** [`TypedDict`](https://docs.python.org/3/library/typing.html#typing.TypedDict)

Parameters for getting list of pushNotificationConfigurations associated with a Task.

#### Attributes

##### id

Task id.

**Type:** [`str`](https://docs.python.org/3/library/stdtypes.html#str)

##### metadata

Extension metadata.

**Type:** [`NotRequired`](https://docs.python.org/3/library/typing.html#typing.NotRequired)\[[`dict`](https://docs.python.org/3/reference/expressions.html#dict)\[[`str`](https://docs.python.org/3/library/stdtypes.html#str), [`Any`](https://docs.python.org/3/library/typing.html#typing.Any)\]\]

### DeleteTaskPushNotificationConfigParams

**Bases:** [`TypedDict`](https://docs.python.org/3/library/typing.html#typing.TypedDict)

Parameters for removing pushNotificationConfiguration associated with a Task.

#### Attributes

##### id

Task id.

**Type:** [`str`](https://docs.python.org/3/library/stdtypes.html#str)

##### push\_notification\_config\_id

The push notification config id to delete.

**Type:** [`str`](https://docs.python.org/3/library/stdtypes.html#str)

##### metadata

Extension metadata.

**Type:** [`NotRequired`](https://docs.python.org/3/library/typing.html#typing.NotRequired)\[[`dict`](https://docs.python.org/3/reference/expressions.html#dict)\[[`str`](https://docs.python.org/3/library/stdtypes.html#str), [`Any`](https://docs.python.org/3/library/typing.html#typing.Any)\]\]

### JSONRPCMessage

**Bases:** [`TypedDict`](https://docs.python.org/3/library/typing.html#typing.TypedDict)

A JSON RPC message.

#### Attributes

##### jsonrpc

The JSON RPC version.

**Type:** [`Literal`](https://docs.python.org/3/library/typing.html#typing.Literal)\['2.0'\]

##### id

The request id.

**Type:** [`int`](https://docs.python.org/3/library/functions.html#int) | [`str`](https://docs.python.org/3/library/stdtypes.html#str) | [`None`](https://docs.python.org/3/library/constants.html#None)

### JSONRPCRequest

**Bases:** `JSONRPCMessage`, `Generic[Method, Params]`

A JSON RPC request.

#### Attributes

##### method

The method to call.

**Type:** `Method`

##### params

The parameters to pass to the method.

**Type:** `Params`

### JSONRPCError

**Bases:** [`TypedDict`](https://docs.python.org/3/library/typing.html#typing.TypedDict), `Generic[CodeT, MessageT]`

A JSON RPC error.

#### Attributes

##### code

A number that indicates the error type that occurred.

**Type:** `CodeT`

##### message

A string providing a short description of the error.

**Type:** `MessageT`

##### data

A primitive or structured value containing additional information about the error.

**Type:** [`NotRequired`](https://docs.python.org/3/library/typing.html#typing.NotRequired)\[[`Any`](https://docs.python.org/3/library/typing.html#typing.Any)\]

### JSONRPCResponse

**Bases:** `JSONRPCMessage`, `Generic[ResultT, ErrorT]`

A JSON RPC response.

### SecurityScheme

A security scheme for authentication.

**Default:** `Annotated[Union[HttpSecurityScheme, ApiKeySecurityScheme, OAuth2SecurityScheme, OpenIdConnectSecurityScheme], pydantic.Field(discriminator='type')]`

### Part

A fully formed piece of content exchanged between a client and a remote agent as part of a Message or an Artifact.

Each Part has its own content type and metadata.

**Default:** `Annotated[Union[TextPart, FilePart, DataPart], pydantic.Field(discriminator='kind')]`

### TaskState

The possible states of a task.

**Type:** [`TypeAlias`](https://docs.python.org/3/library/typing.html#typing.TypeAlias) **Default:** `Literal['submitted', 'working', 'input-required', 'completed', 'canceled', 'failed', 'rejected', 'auth-required', 'unknown']`

### JSONParseError

A JSON RPC error for a parse error.

**Default:** `JSONRPCError[Literal[-32700], Literal['Invalid JSON payload']]`

### InvalidRequestError

A JSON RPC error for an invalid request.

**Default:** `JSONRPCError[Literal[-32600], Literal['Request payload validation error']]`

### MethodNotFoundError

A JSON RPC error for a method not found.

**Default:** `JSONRPCError[Literal[-32601], Literal['Method not found']]`

### InvalidParamsError

A JSON RPC error for invalid parameters.

**Default:** `JSONRPCError[Literal[-32602], Literal['Invalid parameters']]`

### InternalError

A JSON RPC error for an internal error.

**Default:** `JSONRPCError[Literal[-32603], Literal['Internal error']]`

### TaskNotFoundError

A JSON RPC error for a task not found.

**Default:** `JSONRPCError[Literal[-32001], Literal['Task not found']]`

### TaskNotCancelableError

A JSON RPC error for a task not cancelable.

**Default:** `JSONRPCError[Literal[-32002], Literal['Task not cancelable']]`

### PushNotificationNotSupportedError

A JSON RPC error for a push notification not supported.

**Default:** `JSONRPCError[Literal[-32003], Literal['Push notification not supported']]`

### UnsupportedOperationError

A JSON RPC error for an unsupported operation.

**Default:** `JSONRPCError[Literal[-32004], Literal['This operation is not supported']]`

### ContentTypeNotSupportedError

A JSON RPC error for incompatible content types.

**Default:** `JSONRPCError[Literal[-32005], Literal['Incompatible content types']]`

### InvalidAgentResponseError

A JSON RPC error for invalid agent response.

**Default:** `JSONRPCError[Literal[-32006], Literal['Invalid agent response']]`

### SendMessageRequest

A JSON RPC request to send a message.

**Default:** `JSONRPCRequest[Literal['message/send'], MessageSendParams]`

### SendMessageResponse

A JSON RPC response to send a message.

**Default:** `JSONRPCResponse[Union[Task, Message], JSONRPCError[Any, Any]]`

### StreamMessageRequest

A JSON RPC request to stream a message.

**Default:** `JSONRPCRequest[Literal['message/stream'], MessageSendParams]`

### StreamMessageResponse

A JSON RPC response to a StreamMessageRequest.

**Default:** `JSONRPCResponse[Union[Task, Message, TaskStatusUpdateEvent, TaskArtifactUpdateEvent], JSONRPCError[Any, Any]]`

### GetTaskRequest

A JSON RPC request to get a task.

**Default:** `JSONRPCRequest[Literal['tasks/get'], TaskQueryParams]`

### GetTaskResponse

A JSON RPC response to get a task.

**Default:** `JSONRPCResponse[Task, TaskNotFoundError]`

### CancelTaskRequest

A JSON RPC request to cancel a task.

**Default:** `JSONRPCRequest[Literal['tasks/cancel'], TaskIdParams]`

### CancelTaskResponse

A JSON RPC response to cancel a task.

**Default:** `JSONRPCResponse[Task, Union[TaskNotCancelableError, TaskNotFoundError]]`

### SetTaskPushNotificationRequest

A JSON RPC request to set a task push notification.

**Default:** `JSONRPCRequest[Literal['tasks/pushNotification/set'], TaskPushNotificationConfig]`

### SetTaskPushNotificationResponse

A JSON RPC response to set a task push notification.

**Default:** `JSONRPCResponse[TaskPushNotificationConfig, PushNotificationNotSupportedError]`

### GetTaskPushNotificationRequest

A JSON RPC request to get a task push notification.

**Default:** `JSONRPCRequest[Literal['tasks/pushNotification/get'], TaskIdParams]`

### GetTaskPushNotificationResponse

A JSON RPC response to get a task push notification.

**Default:** `JSONRPCResponse[TaskPushNotificationConfig, PushNotificationNotSupportedError]`

### ResubscribeTaskRequest

A JSON RPC request to resubscribe to a task.

**Default:** `JSONRPCRequest[Literal['tasks/resubscribe'], TaskIdParams]`

### ListTaskPushNotificationConfigRequest

A JSON RPC request to list task push notification configs.

**Default:** `JSONRPCRequest[Literal['tasks/pushNotificationConfig/list'], ListTaskPushNotificationConfigParams]`

### DeleteTaskPushNotificationConfigRequest

A JSON RPC request to delete a task push notification config.

**Default:** `JSONRPCRequest[Literal['tasks/pushNotificationConfig/delete'], DeleteTaskPushNotificationConfigParams]`

### A2ARequest

A JSON RPC request to the A2A server.

**Default:** `Annotated[Union[SendMessageRequest, StreamMessageRequest, GetTaskRequest, CancelTaskRequest, SetTaskPushNotificationRequest, GetTaskPushNotificationRequest, ResubscribeTaskRequest, ListTaskPushNotificationConfigRequest, DeleteTaskPushNotificationConfigRequest], Discriminator('method')]`

### A2AResponse

A JSON RPC response from the A2A server.

**Type:** [`TypeAlias`](https://docs.python.org/3/library/typing.html#typing.TypeAlias) **Default:** `Union[SendMessageResponse, StreamMessageResponse, GetTaskResponse, CancelTaskResponse, SetTaskPushNotificationResponse, GetTaskPushNotificationResponse]`

### A2AClient

A client for the A2A protocol.

#### Methods

##### send\_message

`@async`

```python
def send_message(
    message: Message,
    metadata: dict[str, Any] | None = None,
    configuration: MessageSendConfiguration | None = None,
) -> SendMessageResponse
```

Send a message using the A2A protocol.

Returns a JSON-RPC response containing either a result (Task) or an error.

###### Returns

`SendMessageResponse`

### UnexpectedResponseError

**Bases:** [`Exception`](https://docs.python.org/3/library/exceptions.html#Exception)

An error raised when an unexpected response is received from the server.