diff --git a/agents/build/dynamic-variables.mdx b/agents/build/dynamic-variables.mdx index ee88d3d..a7e773c 100644 --- a/agents/build/dynamic-variables.mdx +++ b/agents/build/dynamic-variables.mdx @@ -132,7 +132,8 @@ Custom variables also render inside [webhook tool](/agents/build/webhook-tools#a https://ehr.example.com/patients/{{patient_id}}/appointments?clinic={{clinic_id}} ``` -- In the URL the value is URL-encoded, like argument values. In header values and the body template it is inserted as is. Numbers render as written, booleans as `true` or `false`. +- In the URL the value is URL-encoded, like argument values. In header values it is inserted as is. Numbers render as written, booleans as `true` or `false`. +- In a JSON body, a value inside a string is JSON-escaped, like argument values. See [Values in a JSON body](/agents/build/webhook-tools#values-in-a-json-body). - When the tool declares an argument with the same name as a custom variable, the argument wins: that placeholder is filled from what the agent supplies. - A placeholder with no value renders as an empty string in the request, unlike in the prompt, where it stays visible. diff --git a/agents/build/webhook-tools.mdx b/agents/build/webhook-tools.mdx index 51ef9a6..5608171 100644 --- a/agents/build/webhook-tools.mdx +++ b/agents/build/webhook-tools.mdx @@ -51,6 +51,30 @@ https://api.example.com/orders/{{order_number}} } ``` +### Values in a JSON body + +When the body is JSON, what happens to a value depends on where its placeholder sits: + +- **Inside a JSON string**, like `"note": "{{note}}"`: the value is JSON-escaped. Quotes, backslashes, and line breaks in it can't break the body. +- **Outside a string**, like `"count": {{count}}`: the value is inserted as is. Use this to send a number, a boolean, or a whole object. + +```json Body template +{ + "note": "{{note}}", + "count": {{count}} +} +``` + +If the agent passes `She said "call me back"` as `note`, the request body contains `"note": "She said \"call me back\""`. + +The same rule covers arguments, dynamic variables, and requests from the **Test** tab. + +The body counts as JSON when its content type is `application/json` (the default) or a `+json` type such as `application/vnd.api+json`. A `Content-Type` header on the tool takes priority over the content type setting. Bodies of any other content type are filled in as is. + + +A placeholder outside a string is not checked. If its value isn't valid JSON in that spot, the body isn't either. Put text values in quotes. + + ## Authentication headers Each header has a kind that identifies what it carries: diff --git a/api-reference/openapi.json b/api-reference/openapi.json index 5905b01..aefd15b 100644 --- a/api-reference/openapi.json +++ b/api-reference/openapi.json @@ -66,6 +66,19 @@ "title": "Finished At", "type": "string" }, + "anchor_day": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "default": null, + "description": "UTC day of month used for credit refreshes; clamp to the month's last day. Missing/null falls back to updated_at's UTC day.", + "title": "Anchor Day" + }, "stripe_subscription_id": { "anyOf": [ { @@ -24699,6 +24712,11 @@ ], "default": null, "title": "Channel" + }, + "world_context": { + "default": false, + "title": "World Context", + "type": "boolean" } }, "required": [