***

title: send_sms
slug: /reference/python/agents/function-result/send-sms
description: Send an SMS or MMS message from a tool function.
max-toc-depth: 3
---------------------

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

[functionresult]: /docs/server-sdks/reference/python/agents/function-result

Send an SMS or MMS message to a phone number. At least one of `body` or `media`
must be provided. Generates a SWML `send_sms` verb under the hood.

Raises `ValueError` if neither `body` nor `media` is provided.

## **Parameters**

<ParamField path="to_number" type="str" required={true} toc={true}>
  Destination phone number in E.164 format (e.g., `"+15551234567"`).
</ParamField>

<ParamField path="from_number" type="str" required={true} toc={true}>
  Sender phone number in E.164 format. Must be a number in your SignalWire project.
</ParamField>

<ParamField path="body" type="Optional[str]" default="None" toc={true}>
  Text body of the message.
</ParamField>

<ParamField path="media" type="Optional[list[str]]" default="None" toc={true}>
  List of media URLs to include as MMS attachments.
</ParamField>

<ParamField path="tags" type="Optional[list[str]]" default="None" toc={true}>
  Tags to associate with the message for searching and filtering in the
  SignalWire dashboard.
</ParamField>

<ParamField path="region" type="Optional[str]" default="None" toc={true}>
  Region to originate the message from.
</ParamField>

## **Returns**

[`FunctionResult`][functionresult] — self, for chaining.

## **Examples**

### Text Message

```python {13}
from signalwire import AgentBase
from signalwire import FunctionResult

agent = AgentBase(name="my-agent", route="/agent")
agent.set_prompt_text("You are a helpful assistant.")

@agent.tool(name="send_confirmation", description="Send an order confirmation SMS")
def send_confirmation(args, raw_data):
    phone = args.get("phone_number")
    order_id = args.get("order_id")
    return (
        FunctionResult("I've sent you a confirmation text.")
        .send_sms(
            to_number=phone,
            from_number="+15559876543",
            body=f"Your order {order_id} has been confirmed!"
        )
    )

agent.serve()
```

### MMS with Media

```python {13}
from signalwire import AgentBase
from signalwire import FunctionResult

agent = AgentBase(name="my-agent", route="/agent")
agent.set_prompt_text("You are a helpful assistant.")

@agent.tool(name="send_receipt", description="Send a receipt with media attachment")
def send_receipt(args, raw_data):
    phone = args.get("phone_number")
    receipt_url = args.get("receipt_url")
    return (
        FunctionResult("I've sent your receipt.")
        .send_sms(
            to_number=phone,
            from_number="+15559876543",
            body="Here's your receipt:",
            media=[receipt_url]
        )
    )

agent.serve()
```