# Deployment History

## Get Deployment by ID

`deployment_history.retrieve(strdeployment_id)  -> DeploymentHistory`

**get** `/deployment-history/{deployment_id}`

Get a deployment record by its unique ID.

### Parameters

- `deployment_id: str`

### Returns

- `class DeploymentHistory: …`

  API schema for deployment history.

  - `id: str`

    The unique identifier of the deployment record

  - `agent_id: str`

    The ID of the agent this deployment belongs to

  - `author_email: str`

    Email of the commit author

  - `author_name: str`

    Name of the commit author

  - `branch_name: str`

    Name of the branch

  - `build_timestamp: datetime`

    When the build was created

  - `commit_hash: str`

    Git commit hash for this deployment

  - `deployment_timestamp: datetime`

    When this deployment was first seen in the system

### Example

```python
import os
from agentex import Agentex

client = Agentex(
    api_key=os.environ.get("AGENTEX_SDK_API_KEY"),  # This is the default and can be omitted
)
deployment_history = client.deployment_history.retrieve(
    "deployment_id",
)
print(deployment_history.id)
```

#### Response

```json
{
  "id": "id",
  "agent_id": "agent_id",
  "author_email": "author_email",
  "author_name": "author_name",
  "branch_name": "branch_name",
  "build_timestamp": "2019-12-27T18:11:19.117Z",
  "commit_hash": "commit_hash",
  "deployment_timestamp": "2019-12-27T18:11:19.117Z"
}
```

## List Deployments for an agent

`deployment_history.list(DeploymentHistoryListParams**kwargs)  -> DeploymentHistoryListResponse`

**get** `/deployment-history`

List deployment history for an agent.

### Parameters

- `agent_id: Optional[str]`

- `agent_name: Optional[str]`

- `limit: Optional[int]`

- `order_by: Optional[str]`

- `order_direction: Optional[str]`

- `page_number: Optional[int]`

### Returns

- `List[DeploymentHistory]`

  - `id: str`

    The unique identifier of the deployment record

  - `agent_id: str`

    The ID of the agent this deployment belongs to

  - `author_email: str`

    Email of the commit author

  - `author_name: str`

    Name of the commit author

  - `branch_name: str`

    Name of the branch

  - `build_timestamp: datetime`

    When the build was created

  - `commit_hash: str`

    Git commit hash for this deployment

  - `deployment_timestamp: datetime`

    When this deployment was first seen in the system

### Example

```python
import os
from agentex import Agentex

client = Agentex(
    api_key=os.environ.get("AGENTEX_SDK_API_KEY"),  # This is the default and can be omitted
)
deployment_histories = client.deployment_history.list()
print(deployment_histories)
```

#### Response

```json
[
  {
    "id": "id",
    "agent_id": "agent_id",
    "author_email": "author_email",
    "author_name": "author_name",
    "branch_name": "branch_name",
    "build_timestamp": "2019-12-27T18:11:19.117Z",
    "commit_hash": "commit_hash",
    "deployment_timestamp": "2019-12-27T18:11:19.117Z"
  }
]
```

## Domain Types

### Deployment History

- `class DeploymentHistory: …`

  API schema for deployment history.

  - `id: str`

    The unique identifier of the deployment record

  - `agent_id: str`

    The ID of the agent this deployment belongs to

  - `author_email: str`

    Email of the commit author

  - `author_name: str`

    Name of the commit author

  - `branch_name: str`

    Name of the branch

  - `build_timestamp: datetime`

    When the build was created

  - `commit_hash: str`

    Git commit hash for this deployment

  - `deployment_timestamp: datetime`

    When this deployment was first seen in the system

### Deployment History List Response

- `List[DeploymentHistory]`

  - `id: str`

    The unique identifier of the deployment record

  - `agent_id: str`

    The ID of the agent this deployment belongs to

  - `author_email: str`

    Email of the commit author

  - `author_name: str`

    Name of the commit author

  - `branch_name: str`

    Name of the branch

  - `build_timestamp: datetime`

    When the build was created

  - `commit_hash: str`

    Git commit hash for this deployment

  - `deployment_timestamp: datetime`

    When this deployment was first seen in the system
