Gemini Enterprise for Customer Experience API . projects . locations . apps . message

Instance Methods

close()

Close httplib2 connections.

send(tenant, body=None, x__xgafv=None)

Sends a message to an agent.

Method Details

close()
Close httplib2 connections.
send(tenant, body=None, x__xgafv=None)
Sends a message to an agent.

Args:
  tenant: string, Optional. Tenant ID, provided as a path parameter. (required)
  body: object, The request body.
    The object takes the form of:

{ # Represents a request for the `SendMessage` method.
  "configuration": { # Configuration of a send message request. # Configuration for the send request.
    "acceptedOutputModes": [ # A list of media types the client is prepared to accept for response parts. Agents SHOULD use this to tailor their output.
      "A String",
    ],
    "historyLength": 42, # The maximum number of most recent messages from the task's history to retrieve in the response. An unset value means the client does not impose any limit. A value of zero is a request to not include any messages. The server MUST NOT return more messages than the provided value, but MAY apply a lower limit.
    "returnImmediately": True or False, # If `true`, the operation returns immediately after creating the task, even if processing is still in progress. If `false` (default), the operation MUST wait until the task reaches a terminal (`COMPLETED`, `FAILED`, `CANCELED`, `REJECTED`) or interrupted (`INPUT_REQUIRED`, `AUTH_REQUIRED`) state before returning.
    "taskPushNotificationConfig": { # A container associating a push notification configuration with a specific task. # Configuration for the agent to send push notifications for task updates. Task id should be empty when sending this configuration in a `SendMessage` request.
      "authentication": { # Defines authentication details, used for push notifications. # Authentication information required to send the notification.
        "credentials": "A String", # Push Notification credentials. Format depends on the scheme (e.g., token for Bearer).
        "scheme": "A String", # Required. HTTP Authentication Scheme from the [IANA registry](https://www.iana.org/assignments/http-authschemes/). Examples: `Bearer`, `Basic`, `Digest`. Scheme names are case-insensitive per [RFC 9110 Section 11.1](https://www.rfc-editor.org/rfc/rfc9110#section-11.1).
      },
      "id": "A String", # The push notification configuration details. A unique identifier (e.g. UUID) for this push notification configuration.
      "taskId": "A String", # The ID of the task this configuration is associated with.
      "tenant": "A String", # Optional. Tenant ID.
      "token": "A String", # A token unique for this task or session.
      "url": "A String", # Required. The URL where the notification should be sent.
    },
  },
  "message": { # `Message` is one unit of communication between client and server. It can be associated with a context and/or a task. For server messages, `context_id` must be provided, and `task_id` only if a task was created. For client messages, both fields are optional, with the caveat that if both are provided, they have to match (the `context_id` has to be the one that is set on the task). If only `task_id` is provided, the server will infer `context_id` from it. # Required. The message to send to the agent.
    "contextId": "A String", # Optional. The context id of the message. If set, the message will be associated with the given context.
    "extensions": [ # The URIs of extensions that are present or contributed to this Message.
      "A String",
    ],
    "messageId": "A String", # Required. The unique identifier (e.g. UUID) of the message. This is created by the message creator.
    "metadata": { # Optional. Any metadata to provide along with the message.
      "a_key": "", # Properties of the object.
    },
    "parts": [ # Required. Parts is the container of the message content.
      { # `Part` represents a container for a section of communication content. Parts can be purely textual, some sort of file (image, video, etc) or a structured data blob (i.e. JSON).
        "data": "", # Arbitrary structured `data` as a JSON value (object, array, string, number, boolean, or null).
        "filename": "A String", # An optional `filename` for the file (e.g., "document.pdf").
        "mediaType": "A String", # The `media_type` (MIME type) of the part content (e.g., "text/plain", "application/json", "image/png"). This field is available for all part types.
        "metadata": { # Optional. metadata associated with this part.
          "a_key": "", # Properties of the object.
        },
        "raw": "A String", # The `raw` byte content of a file. In JSON serialization, this is encoded as a base64 string.
        "text": "A String", # The string content of the `text` part.
        "url": "A String", # A `url` pointing to the file's content.
      },
    ],
    "referenceTaskIds": [ # A list of task IDs that this message references for additional context.
      "A String",
    ],
    "role": "A String", # Required. Identifies the sender of the message.
    "taskId": "A String", # Optional. The task id of the message. If set, the message will be associated with the given task.
  },
  "metadata": { # A flexible key-value map for passing additional context or parameters.
    "a_key": "", # Properties of the object.
  },
}

  x__xgafv: string, V1 error format.
    Allowed values
      1 - v1 error format
      2 - v2 error format

Returns:
  An object of the form:

    { # Represents the response for the `SendMessage` method.
  "message": { # `Message` is one unit of communication between client and server. It can be associated with a context and/or a task. For server messages, `context_id` must be provided, and `task_id` only if a task was created. For client messages, both fields are optional, with the caveat that if both are provided, they have to match (the `context_id` has to be the one that is set on the task). If only `task_id` is provided, the server will infer `context_id` from it. # A message from the agent.
    "contextId": "A String", # Optional. The context id of the message. If set, the message will be associated with the given context.
    "extensions": [ # The URIs of extensions that are present or contributed to this Message.
      "A String",
    ],
    "messageId": "A String", # Required. The unique identifier (e.g. UUID) of the message. This is created by the message creator.
    "metadata": { # Optional. Any metadata to provide along with the message.
      "a_key": "", # Properties of the object.
    },
    "parts": [ # Required. Parts is the container of the message content.
      { # `Part` represents a container for a section of communication content. Parts can be purely textual, some sort of file (image, video, etc) or a structured data blob (i.e. JSON).
        "data": "", # Arbitrary structured `data` as a JSON value (object, array, string, number, boolean, or null).
        "filename": "A String", # An optional `filename` for the file (e.g., "document.pdf").
        "mediaType": "A String", # The `media_type` (MIME type) of the part content (e.g., "text/plain", "application/json", "image/png"). This field is available for all part types.
        "metadata": { # Optional. metadata associated with this part.
          "a_key": "", # Properties of the object.
        },
        "raw": "A String", # The `raw` byte content of a file. In JSON serialization, this is encoded as a base64 string.
        "text": "A String", # The string content of the `text` part.
        "url": "A String", # A `url` pointing to the file's content.
      },
    ],
    "referenceTaskIds": [ # A list of task IDs that this message references for additional context.
      "A String",
    ],
    "role": "A String", # Required. Identifies the sender of the message.
    "taskId": "A String", # Optional. The task id of the message. If set, the message will be associated with the given task.
  },
  "task": { # `Task` is the core unit of action for A2A. It has a current status and when results are created for the task they are stored in the artifact. If there are multiple turns for a task, these are stored in history. # The task created or updated by the message.
    "artifacts": [ # A set of output artifacts for a `Task`.
      { # Artifacts represent task outputs.
        "artifactId": "A String", # Required. Unique identifier (e.g. UUID) for the artifact. It must be unique within a task.
        "description": "A String", # Optional. A human readable description of the artifact.
        "extensions": [ # The URIs of extensions that are present or contributed to this Artifact.
          "A String",
        ],
        "metadata": { # Optional. Metadata included with the artifact.
          "a_key": "", # Properties of the object.
        },
        "name": "A String", # A human readable name for the artifact.
        "parts": [ # Required. The content of the artifact. Must contain at least one part.
          { # `Part` represents a container for a section of communication content. Parts can be purely textual, some sort of file (image, video, etc) or a structured data blob (i.e. JSON).
            "data": "", # Arbitrary structured `data` as a JSON value (object, array, string, number, boolean, or null).
            "filename": "A String", # An optional `filename` for the file (e.g., "document.pdf").
            "mediaType": "A String", # The `media_type` (MIME type) of the part content (e.g., "text/plain", "application/json", "image/png"). This field is available for all part types.
            "metadata": { # Optional. metadata associated with this part.
              "a_key": "", # Properties of the object.
            },
            "raw": "A String", # The `raw` byte content of a file. In JSON serialization, this is encoded as a base64 string.
            "text": "A String", # The string content of the `text` part.
            "url": "A String", # A `url` pointing to the file's content.
          },
        ],
      },
    ],
    "contextId": "A String", # Unique identifier (e.g. UUID) for the contextual collection of interactions (tasks and messages).
    "history": [ # protolint:disable REPEATED_FIELD_NAMES_PLURALIZED The history of interactions from a `Task`.
      { # `Message` is one unit of communication between client and server. It can be associated with a context and/or a task. For server messages, `context_id` must be provided, and `task_id` only if a task was created. For client messages, both fields are optional, with the caveat that if both are provided, they have to match (the `context_id` has to be the one that is set on the task). If only `task_id` is provided, the server will infer `context_id` from it.
        "contextId": "A String", # Optional. The context id of the message. If set, the message will be associated with the given context.
        "extensions": [ # The URIs of extensions that are present or contributed to this Message.
          "A String",
        ],
        "messageId": "A String", # Required. The unique identifier (e.g. UUID) of the message. This is created by the message creator.
        "metadata": { # Optional. Any metadata to provide along with the message.
          "a_key": "", # Properties of the object.
        },
        "parts": [ # Required. Parts is the container of the message content.
          { # `Part` represents a container for a section of communication content. Parts can be purely textual, some sort of file (image, video, etc) or a structured data blob (i.e. JSON).
            "data": "", # Arbitrary structured `data` as a JSON value (object, array, string, number, boolean, or null).
            "filename": "A String", # An optional `filename` for the file (e.g., "document.pdf").
            "mediaType": "A String", # The `media_type` (MIME type) of the part content (e.g., "text/plain", "application/json", "image/png"). This field is available for all part types.
            "metadata": { # Optional. metadata associated with this part.
              "a_key": "", # Properties of the object.
            },
            "raw": "A String", # The `raw` byte content of a file. In JSON serialization, this is encoded as a base64 string.
            "text": "A String", # The string content of the `text` part.
            "url": "A String", # A `url` pointing to the file's content.
          },
        ],
        "referenceTaskIds": [ # A list of task IDs that this message references for additional context.
          "A String",
        ],
        "role": "A String", # Required. Identifies the sender of the message.
        "taskId": "A String", # Optional. The task id of the message. If set, the message will be associated with the given task.
      },
    ],
    "id": "A String", # Required. Unique identifier (e.g. UUID) for the task, generated by the server for a new task.
    "metadata": { # protolint:enable REPEATED_FIELD_NAMES_PLURALIZED A key/value object to store custom metadata about a task.
      "a_key": "", # Properties of the object.
    },
    "status": { # A container for the status of a task # Required. The current status of a `Task`, including `state` and a `message`.
      "message": { # `Message` is one unit of communication between client and server. It can be associated with a context and/or a task. For server messages, `context_id` must be provided, and `task_id` only if a task was created. For client messages, both fields are optional, with the caveat that if both are provided, they have to match (the `context_id` has to be the one that is set on the task). If only `task_id` is provided, the server will infer `context_id` from it. # A message associated with the status.
        "contextId": "A String", # Optional. The context id of the message. If set, the message will be associated with the given context.
        "extensions": [ # The URIs of extensions that are present or contributed to this Message.
          "A String",
        ],
        "messageId": "A String", # Required. The unique identifier (e.g. UUID) of the message. This is created by the message creator.
        "metadata": { # Optional. Any metadata to provide along with the message.
          "a_key": "", # Properties of the object.
        },
        "parts": [ # Required. Parts is the container of the message content.
          { # `Part` represents a container for a section of communication content. Parts can be purely textual, some sort of file (image, video, etc) or a structured data blob (i.e. JSON).
            "data": "", # Arbitrary structured `data` as a JSON value (object, array, string, number, boolean, or null).
            "filename": "A String", # An optional `filename` for the file (e.g., "document.pdf").
            "mediaType": "A String", # The `media_type` (MIME type) of the part content (e.g., "text/plain", "application/json", "image/png"). This field is available for all part types.
            "metadata": { # Optional. metadata associated with this part.
              "a_key": "", # Properties of the object.
            },
            "raw": "A String", # The `raw` byte content of a file. In JSON serialization, this is encoded as a base64 string.
            "text": "A String", # The string content of the `text` part.
            "url": "A String", # A `url` pointing to the file's content.
          },
        ],
        "referenceTaskIds": [ # A list of task IDs that this message references for additional context.
          "A String",
        ],
        "role": "A String", # Required. Identifies the sender of the message.
        "taskId": "A String", # Optional. The task id of the message. If set, the message will be associated with the given task.
      },
      "state": "A String", # Required. The current state of this task.
      "timestamp": "A String", # ISO 8601 Timestamp when the status was recorded. Example: "2023-10-27T10:00:00Z"
    },
  },
}