# Sedai Smart Agent

Sedai Smart Agent allows you to seamlessly connect workloads to Sedai by deploying an agent within your cluster. This allows Sedai's core components to securely communicate and operate.

Navigate to **Settings > Integrations** and select the **Add Cloud** button. Follow the prompts to add a Kubernetes cluster and enter the cluster name.

{% hint style="info" %}
If your organization follows the same naming convention across clusters, you can choose to add a nickname to help you easily identify the cluster and its workloads within Sedai.
{% endhint %}

Sedai will generate unique Helm and kubectl commands for you to copy or download (Note: you can alternatively [deploy Smart Agent using GitOps](#deploying-smart-agent-with-gitops)). The deployment manifest file includes the following:

* **Namespace:** Dedicated for deploying `sedai-smart-agent`
* **Service Account:** Dedicated for deploying `sedai-smart-agent`
* **ClusterRole:** For the Service Account; includes [limited permissions](#undefined) to read Kubernetes resources and manage the workloads in your cluster
* **ClusterRoleBinding:** Maps the ClusterRole to the Service Account
* **Deployment:** `sedai-smart-agent` deployment

{% hint style="warning" %}
The kubectl and Helm commands are dynamically generated and will **expire within 30 minutes**. Execute the commands once they are generated to avoid connection issues.
{% endhint %}

Once you apply the manifest, `sedai-smart-agent` will be deployed in your cluster (it will take a few minutes for `sedai-core` to discover your cluster's resources).

After you copy/download your preferred command, you will next be prompted to [connect monitoring data](/get-started/onboarding/autonomous-cloud-management/connect-monitoring-data.md).

#### Verify Smart Agent Status

To check whether the Smart Agent has successfully been set up in your cluster, navigate to **System > Health** within Sedai and select the **Smart Agent** tab.

### Cluster Role Reference

`get`, `list`, `patch`, `update`, and `watch` apply to the following apiGroups:

| ""                               | ReplicatonController, Services, Pods               |
| -------------------------------- | -------------------------------------------------- |
| apps                             | DaemonSets, Deployments, ReplicaSets, StatefulSets |
| autoscaling / autoscaling.k8s.io | HorizontalPodAutoscalers, VerticalPodAutoscalers   |
| batch                            | CronJobs, Jobs                                     |
| policy                           | PodDisruptionBudgets                               |

`get`, `list`, and `watch` apply to the following apiGroups:

| networking.k8s.io | Ingresses, IngressClasses, NetworkPolicies |
| ----------------- | ------------------------------------------ |
| metrics.k8s.io    | Pods, Nodes                                |

***

### Deploying Smart Agent using GitOps

You can deploy the Sedai Smart Agent with your preferred GitOps provider by clicking **Use GitOps** on the **Deploy Sedai Smart Agent** screen. Download the Helm or kubectl command and push to your GitOps repository. These commands will exclude secrets, allowing you to manage secrets later on outside of your repository. After you've deployed the initial command, run the additional kubectl command to generate the Kubernetes secret.

Once you've deployed the Agent, be sure to [verify the status](#verify-smart-agent-status).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sedai.io/get-started/onboarding/autonomous-cloud-management/connect-kubernetes-cluster/sedai-smart-agent.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
