> This page is for Server SDKs.

> 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.

# set_response

> Set or replace the response text on a FunctionResult.

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

[settoolresponse]: /docs/server-sdks/reference/python/agents/function-result/set-tool-response

Set or replace the response after construction. The response is a prompt
injected into the model's context, not text spoken verbatim, so write it as an
instruction in the second person. To separate a factual outcome from the
speaking instruction, use [`set_tool_response()`][settoolresponse] instead.

## **Parameters**

**`response`** `str` — required

Instruction for the model, such as `"Tell the caller their order shipped
  yesterday."`

---

## **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"Tell the caller order {order_id} shipped yesterday.")
    else:
        result.set_response("Tell the caller you couldn't find that order number.")
    return result

agent.serve()
```