***

title: connect
slug: /reference/python/agents/function-result/connect
description: Transfer or connect the call to another destination.
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

Transfer or connect the call to another destination. Generates a SWML `connect`
verb under the hood.

<Note>
  When `final=True` (the default), the call permanently leaves the agent. When
  `final=False`, the call returns to the agent if the far end hangs up first.
</Note>

## **Parameters**

<ParamField path="destination" type="str" required={true} toc={true}>
  Where to connect the call. Accepts a phone number in E.164 format (e.g.,
  `"+15551234567"`) or a SIP address (e.g., `"support@company.com"`).
</ParamField>

<ParamField path="final" type="bool" default="True" toc={true}>
  Whether this is a permanent transfer.

  * `True` — call exits the agent completely (terminal action)
  * `False` — call returns to the agent when the far end hangs up
</ParamField>

<ParamField path="from_addr" type="Optional[str]" default="None" toc={true}>
  Caller ID override. Phone number or SIP address to show as the caller. When
  `None`, the current call's originating address is used.
</ParamField>

## **Returns**

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

## **Examples**

### Permanent Transfer

```python {11}
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="transfer_to_sales", description="Transfer caller to the sales team")
def transfer_to_sales(args, raw_data):
    return (
        FunctionResult("Transferring you to sales.")
        .connect("+15551234567", final=True)
    )

agent.serve()
```

### Temporary Transfer

```python {11}
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="consult_specialist", description="Connect to a specialist temporarily")
def consult_specialist(args, raw_data):
    return (
        FunctionResult("Connecting you to a specialist.")
        .connect("+15551234567", final=False)
    )

agent.serve()
```

### Custom Caller ID

```python {11}
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="transfer_with_caller_id", description="Transfer with custom caller ID")
def transfer_with_caller_id(args, raw_data):
    return (
        FunctionResult("Transferring now.")
        .connect(
            "support@company.com",
            final=True,
            from_addr="+15559876543"
        )
    )

agent.serve()
```