Change what an agent says

Edit the Call Agent's instructions to change the conversation. The same edit process applies to agents for outbound and inbound calls.

PUT replaces the complete configuration. It is not a partial update. Keep every setting that should remain, including voices, webhooks, and participant settings. An optional setting that you leave out can clear its current value.

Read the agent before you edit it

Complete Get access first. Use the Call Agent ID, not the ID of a call.

read -r -p 'Call Agent id: ' CALL_AGENT_ID

curl --fail-with-body --silent --show-error \
  "$RESIA_API_BASE/v1/call-agents/$CALL_AGENT_ID" \
  --header "Authorization: Bearer $RESIA_API_KEY" \
  --output agent-current.json

curl --fail-with-body --silent --show-error \
  "$RESIA_API_BASE/openapi.json" --output resia-openapi.json

jq --slurpfile api resia-openapi.json \
  'with_entries(select(.key as $key | $api[0].components.schemas.CallAgentWrite.properties | has($key)))' \
  agent-current.json > agent-update.json

The last command keeps fields that the API accepts for an agent update. It removes response-only fields such as id and review_status. Keep agent-current.json as a record of the configuration you read.

API reference: Read a Call Agent.

Change the instructions

Open agent-update.json in your text editor. Change instructions to describe the conversation you want. Keep the other fields unless you intend to change them. Avoid simultaneous edits by two people; a later complete update can overwrite an earlier one.

For a greeting on an inbound call, set agent_speaks_first to true. To leave a message when an outbound call reaches voicemail, set should_leave_voicemail to true. Neither setting creates an inbound number assignment.

Use variables correctly

Use $topic or ${topic} to insert the top-level input named topic. Use $$ for a literal dollar sign. Do not use {{topic}} or a nested path such as $person.name.

For example, this instruction uses one variable:

You are a helpful assistant. Ask the person one question about $topic.

Declare that variable in input_schema:

{
  "type": "object",
  "properties": {"topic": {"type": "string"}},
  "required": ["topic"],
  "additionalProperties": false
}

For an outbound call, pass {"topic": "office hours"} in the call's inputs. For an inbound call, return that object from the inbound webhook. Every referenced placeholder needs a value, even if the schema marks its property as optional.

Save the complete configuration

curl --fail-with-body --silent --show-error \
  --request PUT "$RESIA_API_BASE/v1/call-agents/$CALL_AGENT_ID" \
  --header "Authorization: Bearer $RESIA_API_KEY" \
  --header 'Content-Type: application/json' \
  --data-binary @agent-update.json \
  --output agent-updated.json

jq '{id, review_status, is_active, active_updated_at}' agent-updated.json

Expected result: HTTP 200 and the same agent id. New instructions can need review. While review is pending, calls continue to use the previous active instructions. Agent settings such as webhook URLs can take effect immediately, before instruction approval. Confirm review_status is approved before a test of the new instructions. An is_active value of true alone can describe the previous active version.

If it fails: A 422 response can identify invalid JSON, missing required fields, an invalid schema, or an undeclared placeholder. Read the error message before you resend the update.

API reference: Replace a Call Agent.