---
title: shutdown_agent (Python agent API)
source: https://docs.newrelic.com/docs/apm/agents/python-agent/python-agent-api/shutdownagent-python-agent-api
---

## Syntax

```py
newrelic.agent.shutdown_agent(timeout=None)
```

Forcibly shuts down the agent.

## Description

Forcibly shut down the agent. The agent makes a final attempt to upload data to the [collector](https://docs.newrelic.com/docs/accounts-partnerships/education/getting-started-new-relic/glossary#collector).

## Parameters

| Parameter                  | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| -------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `timeout` _int_ or _float_ | Optional, but highly recommended. The maximum length of time the caller waits for the agent to finish uploading data. If the timeout period ends before the agent finishes, the agent continues reporting data in the background, but the caller may forcibly kill the whole process and stop the upload. If no value is set or set to `None`, the agent uses the default global timeout value, which can be overriden in configuration settings but defaults to 2.5 seconds. |

## Return values

None.

## Examples

### With a three second timeout [#timeout-example]

```py
newrelic.agent.shutdown_agent(timeout=3)
```
