***

title: set_response
slug: /reference/python/agents/function-result/set-response
description: Set or replace the response text on a FunctionResult.
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

Set or replace the response text after construction. The response is the text
the AI speaks back to the caller after the function executes.

## **Parameters**

<ParamField path="response" type="str" required={true} toc={true}>
  Text for the AI to speak to the caller.
</ParamField>

## **Returns**

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

## **Example**

```python {12,14}
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="check_order", description="Look up an order by ID")
def check_order(args, raw_data):
    order_id = args.get("order_id")
    result = FunctionResult()
    if order_id:
        result.set_response(f"Your order {order_id} shipped yesterday.")
    else:
        result.set_response("I couldn't find that order number.")
    return result

agent.serve()
```