# Events

## Get Event

`client.events.retrieve(stringeventID, RequestOptionsoptions?): Event`

**get** `/events/{event_id}`

Get Event

### Parameters

- `eventID: string`

### Returns

- `Event`

  - `id: string`

    The UUID of the event

  - `agent_id: string`

    The UUID of the agent that the event belongs to

  - `sequence_id: number`

    The sequence ID of the event

  - `task_id: string`

    The UUID of the task that the event belongs to

  - `content?: TaskMessageContent | null`

    The content of the event

    - `TextContent`

      - `author: MessageAuthor`

        The role of the messages author, in this case `system`, `user`, `assistant`, or `tool`.

        - `"user"`

        - `"agent"`

      - `content: string`

        The contents of the text message.

      - `attachments?: Array<Attachment> | null`

        Optional list of file attachments with structured metadata.

        - `file_id: string`

          The unique ID of the attached file

        - `name: string`

          The name of the file

        - `size: number`

          The size of the file in bytes

        - `type: string`

          The MIME type or content type of the file

      - `format?: TextFormat`

        The format of the message. This is used by the client to determine how to display the message.

        - `"markdown"`

        - `"plain"`

        - `"code"`

      - `style?: MessageStyle`

        The style of the message. This is used by the client to determine how to display the message.

        - `"static"`

        - `"active"`

      - `type?: "text"`

        The type of the message, in this case `text`.

        - `"text"`

    - `ReasoningContent`

      - `author: MessageAuthor`

        The role of the messages author, in this case `system`, `user`, `assistant`, or `tool`.

      - `summary: Array<string>`

        A list of short reasoning summaries

      - `content?: Array<string> | null`

        The reasoning content or chain-of-thought text

      - `style?: MessageStyle`

        The style of the message. This is used by the client to determine how to display the message.

      - `type?: "reasoning"`

        The type of the message, in this case `reasoning`.

        - `"reasoning"`

    - `DataContent`

      - `author: MessageAuthor`

        The role of the messages author, in this case `system`, `user`, `assistant`, or `tool`.

      - `data: Record<string, unknown>`

        The contents of the data message.

      - `style?: MessageStyle`

        The style of the message. This is used by the client to determine how to display the message.

      - `type?: "data"`

        The type of the message, in this case `data`.

        - `"data"`

    - `ToolRequestContent`

      - `arguments: Record<string, unknown>`

        The arguments to the tool.

      - `author: MessageAuthor`

        The role of the messages author, in this case `system`, `user`, `assistant`, or `tool`.

      - `name: string`

        The name of the tool that is being requested.

      - `tool_call_id: string`

        The ID of the tool call that is being requested.

      - `style?: MessageStyle`

        The style of the message. This is used by the client to determine how to display the message.

      - `type?: "tool_request"`

        The type of the message, in this case `tool_request`.

        - `"tool_request"`

    - `ToolResponseContent`

      - `author: MessageAuthor`

        The role of the messages author, in this case `system`, `user`, `assistant`, or `tool`.

      - `content: unknown`

        The result of the tool.

      - `name: string`

        The name of the tool that is being responded to.

      - `tool_call_id: string`

        The ID of the tool call that is being responded to.

      - `is_error?: boolean | null`

        Whether the tool call resulted in an error. `None` when the harness does not report a status.

      - `style?: MessageStyle`

        The style of the message. This is used by the client to determine how to display the message.

      - `type?: "tool_response"`

        The type of the message, in this case `tool_response`.

        - `"tool_response"`

  - `created_at?: string | null`

    The timestamp of the event

### Example

```typescript
import Agentex from 'agentex';

const client = new Agentex({
  apiKey: process.env['AGENTEX_SDK_API_KEY'], // This is the default and can be omitted
});

const event = await client.events.retrieve('event_id');

console.log(event.id);
```

#### Response

```json
{
  "id": "id",
  "agent_id": "agent_id",
  "sequence_id": 0,
  "task_id": "task_id",
  "content": {
    "author": "user",
    "content": "content",
    "attachments": [
      {
        "file_id": "file_id",
        "name": "name",
        "size": 0,
        "type": "type"
      }
    ],
    "format": "markdown",
    "style": "static",
    "type": "text"
  },
  "created_at": "2019-12-27T18:11:19.117Z"
}
```

## List Events

`client.events.list(EventListParamsquery, RequestOptionsoptions?): EventListResponse`

**get** `/events`

List events for a specific task and agent.

Optionally filter for events after a specific sequence ID.
Results are ordered by sequence_id.

### Parameters

- `query: EventListParams`

  - `agent_id: string`

    The agent ID to filter events by

  - `task_id: string`

    The task ID to filter events by

  - `last_processed_event_id?: string | null`

    Optional event ID to get events after this ID

  - `limit?: number | null`

    Optional limit on number of results

### Returns

- `EventListResponse = Array<Event>`

  - `id: string`

    The UUID of the event

  - `agent_id: string`

    The UUID of the agent that the event belongs to

  - `sequence_id: number`

    The sequence ID of the event

  - `task_id: string`

    The UUID of the task that the event belongs to

  - `content?: TaskMessageContent | null`

    The content of the event

    - `TextContent`

      - `author: MessageAuthor`

        The role of the messages author, in this case `system`, `user`, `assistant`, or `tool`.

        - `"user"`

        - `"agent"`

      - `content: string`

        The contents of the text message.

      - `attachments?: Array<Attachment> | null`

        Optional list of file attachments with structured metadata.

        - `file_id: string`

          The unique ID of the attached file

        - `name: string`

          The name of the file

        - `size: number`

          The size of the file in bytes

        - `type: string`

          The MIME type or content type of the file

      - `format?: TextFormat`

        The format of the message. This is used by the client to determine how to display the message.

        - `"markdown"`

        - `"plain"`

        - `"code"`

      - `style?: MessageStyle`

        The style of the message. This is used by the client to determine how to display the message.

        - `"static"`

        - `"active"`

      - `type?: "text"`

        The type of the message, in this case `text`.

        - `"text"`

    - `ReasoningContent`

      - `author: MessageAuthor`

        The role of the messages author, in this case `system`, `user`, `assistant`, or `tool`.

      - `summary: Array<string>`

        A list of short reasoning summaries

      - `content?: Array<string> | null`

        The reasoning content or chain-of-thought text

      - `style?: MessageStyle`

        The style of the message. This is used by the client to determine how to display the message.

      - `type?: "reasoning"`

        The type of the message, in this case `reasoning`.

        - `"reasoning"`

    - `DataContent`

      - `author: MessageAuthor`

        The role of the messages author, in this case `system`, `user`, `assistant`, or `tool`.

      - `data: Record<string, unknown>`

        The contents of the data message.

      - `style?: MessageStyle`

        The style of the message. This is used by the client to determine how to display the message.

      - `type?: "data"`

        The type of the message, in this case `data`.

        - `"data"`

    - `ToolRequestContent`

      - `arguments: Record<string, unknown>`

        The arguments to the tool.

      - `author: MessageAuthor`

        The role of the messages author, in this case `system`, `user`, `assistant`, or `tool`.

      - `name: string`

        The name of the tool that is being requested.

      - `tool_call_id: string`

        The ID of the tool call that is being requested.

      - `style?: MessageStyle`

        The style of the message. This is used by the client to determine how to display the message.

      - `type?: "tool_request"`

        The type of the message, in this case `tool_request`.

        - `"tool_request"`

    - `ToolResponseContent`

      - `author: MessageAuthor`

        The role of the messages author, in this case `system`, `user`, `assistant`, or `tool`.

      - `content: unknown`

        The result of the tool.

      - `name: string`

        The name of the tool that is being responded to.

      - `tool_call_id: string`

        The ID of the tool call that is being responded to.

      - `is_error?: boolean | null`

        Whether the tool call resulted in an error. `None` when the harness does not report a status.

      - `style?: MessageStyle`

        The style of the message. This is used by the client to determine how to display the message.

      - `type?: "tool_response"`

        The type of the message, in this case `tool_response`.

        - `"tool_response"`

  - `created_at?: string | null`

    The timestamp of the event

### Example

```typescript
import Agentex from 'agentex';

const client = new Agentex({
  apiKey: process.env['AGENTEX_SDK_API_KEY'], // This is the default and can be omitted
});

const events = await client.events.list({ agent_id: 'agent_id', task_id: 'task_id' });

console.log(events);
```

#### Response

```json
[
  {
    "id": "id",
    "agent_id": "agent_id",
    "sequence_id": 0,
    "task_id": "task_id",
    "content": {
      "author": "user",
      "content": "content",
      "attachments": [
        {
          "file_id": "file_id",
          "name": "name",
          "size": 0,
          "type": "type"
        }
      ],
      "format": "markdown",
      "style": "static",
      "type": "text"
    },
    "created_at": "2019-12-27T18:11:19.117Z"
  }
]
```

## Domain Types

### Event

- `Event`

  - `id: string`

    The UUID of the event

  - `agent_id: string`

    The UUID of the agent that the event belongs to

  - `sequence_id: number`

    The sequence ID of the event

  - `task_id: string`

    The UUID of the task that the event belongs to

  - `content?: TaskMessageContent | null`

    The content of the event

    - `TextContent`

      - `author: MessageAuthor`

        The role of the messages author, in this case `system`, `user`, `assistant`, or `tool`.

        - `"user"`

        - `"agent"`

      - `content: string`

        The contents of the text message.

      - `attachments?: Array<Attachment> | null`

        Optional list of file attachments with structured metadata.

        - `file_id: string`

          The unique ID of the attached file

        - `name: string`

          The name of the file

        - `size: number`

          The size of the file in bytes

        - `type: string`

          The MIME type or content type of the file

      - `format?: TextFormat`

        The format of the message. This is used by the client to determine how to display the message.

        - `"markdown"`

        - `"plain"`

        - `"code"`

      - `style?: MessageStyle`

        The style of the message. This is used by the client to determine how to display the message.

        - `"static"`

        - `"active"`

      - `type?: "text"`

        The type of the message, in this case `text`.

        - `"text"`

    - `ReasoningContent`

      - `author: MessageAuthor`

        The role of the messages author, in this case `system`, `user`, `assistant`, or `tool`.

      - `summary: Array<string>`

        A list of short reasoning summaries

      - `content?: Array<string> | null`

        The reasoning content or chain-of-thought text

      - `style?: MessageStyle`

        The style of the message. This is used by the client to determine how to display the message.

      - `type?: "reasoning"`

        The type of the message, in this case `reasoning`.

        - `"reasoning"`

    - `DataContent`

      - `author: MessageAuthor`

        The role of the messages author, in this case `system`, `user`, `assistant`, or `tool`.

      - `data: Record<string, unknown>`

        The contents of the data message.

      - `style?: MessageStyle`

        The style of the message. This is used by the client to determine how to display the message.

      - `type?: "data"`

        The type of the message, in this case `data`.

        - `"data"`

    - `ToolRequestContent`

      - `arguments: Record<string, unknown>`

        The arguments to the tool.

      - `author: MessageAuthor`

        The role of the messages author, in this case `system`, `user`, `assistant`, or `tool`.

      - `name: string`

        The name of the tool that is being requested.

      - `tool_call_id: string`

        The ID of the tool call that is being requested.

      - `style?: MessageStyle`

        The style of the message. This is used by the client to determine how to display the message.

      - `type?: "tool_request"`

        The type of the message, in this case `tool_request`.

        - `"tool_request"`

    - `ToolResponseContent`

      - `author: MessageAuthor`

        The role of the messages author, in this case `system`, `user`, `assistant`, or `tool`.

      - `content: unknown`

        The result of the tool.

      - `name: string`

        The name of the tool that is being responded to.

      - `tool_call_id: string`

        The ID of the tool call that is being responded to.

      - `is_error?: boolean | null`

        Whether the tool call resulted in an error. `None` when the harness does not report a status.

      - `style?: MessageStyle`

        The style of the message. This is used by the client to determine how to display the message.

      - `type?: "tool_response"`

        The type of the message, in this case `tool_response`.

        - `"tool_response"`

  - `created_at?: string | null`

    The timestamp of the event

### Event List Response

- `EventListResponse = Array<Event>`

  - `id: string`

    The UUID of the event

  - `agent_id: string`

    The UUID of the agent that the event belongs to

  - `sequence_id: number`

    The sequence ID of the event

  - `task_id: string`

    The UUID of the task that the event belongs to

  - `content?: TaskMessageContent | null`

    The content of the event

    - `TextContent`

      - `author: MessageAuthor`

        The role of the messages author, in this case `system`, `user`, `assistant`, or `tool`.

        - `"user"`

        - `"agent"`

      - `content: string`

        The contents of the text message.

      - `attachments?: Array<Attachment> | null`

        Optional list of file attachments with structured metadata.

        - `file_id: string`

          The unique ID of the attached file

        - `name: string`

          The name of the file

        - `size: number`

          The size of the file in bytes

        - `type: string`

          The MIME type or content type of the file

      - `format?: TextFormat`

        The format of the message. This is used by the client to determine how to display the message.

        - `"markdown"`

        - `"plain"`

        - `"code"`

      - `style?: MessageStyle`

        The style of the message. This is used by the client to determine how to display the message.

        - `"static"`

        - `"active"`

      - `type?: "text"`

        The type of the message, in this case `text`.

        - `"text"`

    - `ReasoningContent`

      - `author: MessageAuthor`

        The role of the messages author, in this case `system`, `user`, `assistant`, or `tool`.

      - `summary: Array<string>`

        A list of short reasoning summaries

      - `content?: Array<string> | null`

        The reasoning content or chain-of-thought text

      - `style?: MessageStyle`

        The style of the message. This is used by the client to determine how to display the message.

      - `type?: "reasoning"`

        The type of the message, in this case `reasoning`.

        - `"reasoning"`

    - `DataContent`

      - `author: MessageAuthor`

        The role of the messages author, in this case `system`, `user`, `assistant`, or `tool`.

      - `data: Record<string, unknown>`

        The contents of the data message.

      - `style?: MessageStyle`

        The style of the message. This is used by the client to determine how to display the message.

      - `type?: "data"`

        The type of the message, in this case `data`.

        - `"data"`

    - `ToolRequestContent`

      - `arguments: Record<string, unknown>`

        The arguments to the tool.

      - `author: MessageAuthor`

        The role of the messages author, in this case `system`, `user`, `assistant`, or `tool`.

      - `name: string`

        The name of the tool that is being requested.

      - `tool_call_id: string`

        The ID of the tool call that is being requested.

      - `style?: MessageStyle`

        The style of the message. This is used by the client to determine how to display the message.

      - `type?: "tool_request"`

        The type of the message, in this case `tool_request`.

        - `"tool_request"`

    - `ToolResponseContent`

      - `author: MessageAuthor`

        The role of the messages author, in this case `system`, `user`, `assistant`, or `tool`.

      - `content: unknown`

        The result of the tool.

      - `name: string`

        The name of the tool that is being responded to.

      - `tool_call_id: string`

        The ID of the tool call that is being responded to.

      - `is_error?: boolean | null`

        Whether the tool call resulted in an error. `None` when the harness does not report a status.

      - `style?: MessageStyle`

        The style of the message. This is used by the client to determine how to display the message.

      - `type?: "tool_response"`

        The type of the message, in this case `tool_response`.

        - `"tool_response"`

  - `created_at?: string | null`

    The timestamp of the event
