***

title: add_verb
slug: /reference/python/agents/swml-service/add-verb
description: Add a SWML verb to the main section of the document.
max-toc-depth: 3
---------------------

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

[ref-swmlservice]: /docs/server-sdks/reference/python/agents/swml-service

Add a verb to the `main` section of the current SWML document. The verb is validated
against the SWML schema (or a registered custom handler) before being appended. Raises
`SchemaValidationError` if validation is enabled and the verb config is invalid.

<Note>
  [SWMLService][ref-swmlservice] also auto-generates convenience methods for every verb defined in the SWML
  schema (e.g., `service.play(url=...)`, `service.connect(to=...)`). These call `add_verb`
  internally. Use `add_verb` directly when you need to pass a pre-built config dictionary
  or work with custom verbs.
</Note>

## **Parameters**

<ParamField path="verb_name" type="str" required={true} toc={true}>
  The SWML verb name (e.g., `"answer"`, `"play"`, `"ai"`, `"hangup"`, `"connect"`).
</ParamField>

<ParamField path="config" type="dict[str, Any] | int" required={true} toc={true}>
  Configuration dictionary for the verb. Most verbs accept a dict of parameters.
  The `sleep` verb is a special case that accepts a direct `int` value representing
  milliseconds.
</ParamField>

## **Returns**

`bool` — `True` if the verb was added successfully, `False` if the config type was
invalid (non-dict for non-sleep verbs).

## **Example**

```python {4-7}
from signalwire import SWMLService

service = SWMLService(name="ivr")
service.add_verb("answer", {})
service.add_verb("play", {"url": "https://example.com/greeting.mp3"})
service.add_verb("sleep", 2000)
service.add_verb("hangup", {"reason": "completed"})

print(service.render_document())
```