> ## Documentation Index
> Fetch the complete documentation index at: https://docs.komodor.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Adopt agents installed with Helm

> Let KAOP manage the agents you already run from a Helm release, see what adoption does to Helm, and give an agent back to Helm.

Koperator finds the agents that you installed with the agent base chart in the namespaces it
manages. The Komodor Agentic Operation Platform (KAOP) shows them as **unmanaged** on the deploy
target. When an agent in your account matches one, a developer, an owner or an admin adopts it with
**Adopt**; otherwise the deploy target says that no agent in this account matches it. After the adoption, developers change the
agent from KAOP like any agent that koperator deployed.

Adoption changes what Helm and your GitOps tool see, so read [What adoption does to
Helm](#what-adoption-does-to-helm) before you adopt.

## Adopt an agent

Adoption keeps the agent's identity, history and credentials. If the result is the same as what
runs, no pod restarts; if not, the pods roll, and a new pod starts before an old one stops.

Koperator reports the values you set on each release, but never the inline worker token or LLM key.
A value set inline in `env` that looks like a secret, for example `GITHUB_TOKEN`, is sent as
`<redacted-by-koperator>`, and KAOP refuses to adopt that agent until you move the value to a
Secret. To adopt it without a Secret, set `discovery.reportInlineSecrets: true`; koperator then sends
those values, and KAOP stores them with the agent.

> [!WARNING]
>
> If Argo CD or Flux manages the release, remove the agent from that tool before the adoption.
> Otherwise koperator and the tool change the agent in turn, and KAOP shows the agent as failed with
> `drift_conflict`.

## What adoption does to Helm

Koperator takes the agent over from its Helm release so that the two never fight over it. It
removes Helm's ownership annotations and labels from the agent's objects, and it relabels each
release Secret from `owner=helm` to `owner=koperator-adopted`, which it keeps as a backup. After the
adoption:

* `helm list` does not show the release.
* `helm uninstall` fails with `release: not found` and deletes nothing.
* `helm upgrade --install` fails with `invalid ownership metadata` and changes nothing.

## Give an agent back to Helm

First make sure koperator no longer manages the agent, for example by uninstalling koperator with
`uninstall.policy: keep` (see [Uninstall koperator](https://docs.komodor.com/manage-your-agents/build/koperator/uninstall.md)).
Then restore the release Secrets and Helm's ownership:

```sh theme={null}
NS=<namespace>
RELEASE=<release>    # the agent's Helm release, which has the same name as its Deployment
kubectl -n "$NS" label secret -l "name=$RELEASE,owner=koperator-adopted" owner=helm --overwrite
kubectl -n "$NS" annotate deployment,service,configmap,serviceaccount -l "agentops.komodor.io/agent-id=$RELEASE" \
  "meta.helm.sh/release-name=$RELEASE" "meta.helm.sh/release-namespace=$NS" --overwrite
kubectl -n "$NS" label deployment,service,configmap,serviceaccount -l "agentops.komodor.io/agent-id=$RELEASE" \
  app.kubernetes.io/managed-by=Helm --overwrite
```

After the first command, `helm list` and `helm history` show the release again. The other two let
`helm upgrade` change the objects again. With Helm 4, add `--force-conflicts` to the first
`helm upgrade` if you stopped koperator some other way than a `keep` uninstall.

## Next steps

> [card] [Argo CD and Flux](https://docs.komodor.com/manage-your-agents/build/koperator/gitops.md)
>
> Run koperator under a GitOps tool, and handle drift.

> [card] [Uninstall koperator](https://docs.komodor.com/manage-your-agents/build/koperator/uninstall.md)
>
> Choose what happens to the agents when koperator goes away.


## Related topics

- [Deploy agents to a deploy target](https://docs.komodor.com/manage-your-agents/build/koperator/deploy-agents.md)
- [Argo CD and Flux](https://docs.komodor.com/manage-your-agents/build/koperator/gitops.md)
- [Install koperator on a deploy target](https://docs.komodor.com/manage-your-agents/build/koperator/install.md)
- [Koperator](https://docs.komodor.com/manage-your-agents/build/koperator/overview.md)
- [Agent marketplace](https://docs.komodor.com/manage-your-agents/build/agent-marketplace.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.