Skip to content

SWML reference: document the ai_response variable #618

Description

@hey-august

ai_response is the variable that decides what an AI agent learns after the platform runs an action on its behalf. Set it before a pay, a prompt, or a play, and its value is what the agent receives as its next piece of context. Nothing else from that action reaches the model.

It has no coverage anywhere in the SWML reference.

The content redaction guide (/docs/platform/ai/content-redaction) calls it "the whole control surface here" and uses it in ten places across four examples, with no reference page to link. A reader cannot look up its behavior, and someone who has not read that guide has no way to discover the variable exists.

Evidence it is real

  • The Python SDK's FunctionResult.pay() emits it as {"set": {"ai_response": ...}} immediately ahead of the pay verb (signalwire/core/function_result.py:1042), and .transfer() does the same at :309.
  • Verified as read by the engine on both the ai and amazon_bedrock paths.

What to do

  • Document ai_response where SWML variables are covered, including that it is consumed once as the agent's next context, and that it is the only channel back from a platform action.
  • Link it from the content redaction guide's payment, DTMF, and speak-a-value sections.

Related: #617 is the same class of gap in the AI webhook reference.

Precise engine source references are available on request rather than in a public issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions