> For the complete documentation index, see [llms.txt](https://docs.portainer.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.portainer.io/faqs/upgrading/why-have-my-agents-stopped-working-after-upgrading-portainer.md).

# Why have my agents stopped working after upgrading Portainer?

#### If you have recently updated Portainer and have found your Agents or Edge Agents are no longer communicating, you may need to check to confirm whether you have set a custom AGENT\_SECRET value. <a href="#hs_cos_wrapper_kb-article-module-4" id="hs_cos_wrapper_kb-article-module-4"></a>

If this has been defined on the Portainer Server it will need to be set on the agents as well. This applies to both the standard Portainer Agent and the Portainer Edge Agent from BE 2.10 onwards.

{% hint style="info" %}
The default installation methods for Portainer Server do not set a custom AGENT\_SECRET value. If you are not sure whether you have a custom value set, please get in touch and our team can help you confirm.
{% endhint %}

For information on how to define the AGENT\_SECRET on each platform, please refer to the respective upgrade instructions:

### Docker Standalone

In your docker run command for your Agent or Edge Agent, set the AGENT\_SECRET environment variable to the value set on your Portainer Server instance:

```
-e AGENT_SECRET=yoursecret
```

\
For example, your Agent docker run command may look like this:

```
1 docker run -d -p 9001:9001 --name portainer_agent --restart=always \

2 -v /var/run/docker.sock:/var/run/docker.sock \

3 -v /var/lib/docker/volumes:/var/lib/docker/volumes \

4 -e AGENT_SECRET=yoursecret

5 portainer/agent:latest
```

### Docker Swarm

In your stack file for your Docker Swarm Agent or Edge Agent deployment, set the AGENT\_SECRET environment variable to the value set on your Portainer Server instance:

```
1 environment:

2 - AGENT_SECRET: yoursecret
```

### Kubernetes

In your YAML file for your Kubernetes Agent or Edge Agent deployment, set the AGENT\_SECRET environment variable to the value set on your Portainer Server instance within the agent deployment definition:

```
1 env:

2 - name: AGENT_SECRET

3 value: yoursecret
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.portainer.io/faqs/upgrading/why-have-my-agents-stopped-working-after-upgrading-portainer.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
