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

# stop • AI Agent SDK

> stop: Best-effort teardown for the runner thread.

# stop

Method

> This is a method of the [**MCPToolRunner**](https://praison.ai/docs/sdk/reference/praisonaiagents/classes/MCPToolRunner.md) class in the [**mcp**](https://praison.ai/docs/sdk/reference/praisonaiagents/modules/mcp.md) module.

Best-effort teardown for the runner thread.

Queues the shutdown sentinel and joins the thread so the request loop
exits and its stdio subprocess is terminated instead of leaking a
background thread (and its child) across the process lifetime. The
request loop reads the sentinel promptly and cancels any in-flight
calls, which are answered with an error instead of left waiting.

## Signature

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
def stop(timeout: Any) -> Any
```

## Parameters

**timeout** `Any`

Seconds to wait for the thread to exit. Defaults to the runner's own operation `timeout` so an in-flight call has a chance to finish before we give up. The thread is a daemon, so this never blocks interpreter exit even if the join times out.

### Returns

**Returns** `Any`

The result of the operation.

## Uses

* `put`
* `is_set`
* `call_soon_threadsafe`
* `is_alive`

## Source

> [card] [View on GitHub](https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/mcp/mcp.py#L416)
>
> `praisonaiagents/mcp/mcp.py` at line 416


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