***

title: setup_graceful_shutdown
slug: /reference/python/agents/agent-base/setup-graceful-shutdown
description: Register signal handlers for graceful shutdown, useful for Kubernetes and containerized deployments.
max-toc-depth: 3
---------------------

For a complete index of all SignalWire documentation pages, fetch https://signalwire.com/docs/llms.txt

Register signal handlers for `SIGTERM` and `SIGINT` so the agent shuts down cleanly.
This is especially useful in Kubernetes deployments where the pod receives `SIGTERM`
before termination.

## **Parameters**

None.

## **Returns**

`None`

## **Example**

```python {5}
from signalwire import AgentBase

agent = AgentBase(name="support", route="/support")
agent.set_prompt_text("You are a helpful assistant.")
agent.setup_graceful_shutdown()
agent.serve()
```