> Fetch clean Markdown by appending `.md` to any page URL under https://signalwire.com/docs or requesting it with the HTTP header `Accept: text/markdown`. The root index at https://signalwire.com/docs/llms.txt lists the available documentation indexes. # AIAction > Action handle for an active AI agent session. [call-ai]: /docs/server-sdks/reference/python/relay/call/ai [base-action-interface]: /docs/server-sdks/reference/python/relay/actions [stop]: /docs/server-sdks/reference/python/relay/actions/ai-action/stop Returned from [`call.ai()`][call-ai]. Tracks an active AI agent session on the call. Terminal states: `finished`, `error`. > **Note** > > AI sessions typically end when the call ends or when explicitly stopped. The > terminal event may not carry a standard `state` field like other actions. Inherits all properties and methods from the [base Action interface][base-action-interface] (`control_id`, `is_done`, `completed`, `result`, `wait()`). ## **Properties** No additional properties beyond the [base Action interface][base-action-interface]. ## **Methods** #### [stop](/docs/server-sdks/reference/python/relay/actions/ai-action/stop) Stop the AI agent session. ## **Example** ```python from signalwire.relay import RelayClient client = RelayClient( project="your-project-id", token="your-api-token", contexts=["default"], ) @client.on_call async def handle_call(call): await call.answer() action = await call.ai( prompt={"text": "You are a helpful assistant."}, ai_params={"temperature": 0.7}, ) # Wait for it to complete naturally event = await action.wait() client.run() ``` > Action handle for an active AI agent session. ## Docs - [stop](https://signalwire.com/docs/server-sdks/reference/python/relay/actions/ai-action/stop.md): Stop the AI agent session.