Skip to content
On this page

Agent Script

The agent script is the system prompt that defines your chat widget's personality, behavior, and instructions. It's the first thing the LLM sees when responding to a visitor's message.

Overview

The script field is a free-text field on your user account that gets injected as the system prompt in every chat widget conversation. Use it to define:

  • Your bot's persona and tone
  • Company-specific knowledge and context
  • Response formatting rules
  • Escalation and handoff instructions
  • Any custom behavior your use case requires

API Access

The agent script can be managed via API:

  • GET /users/script — Retrieve the current script
  • PUT /users/script — Update the script

See the API Reference for full details.

Example

bash
# Get current script
curl https://api.canny.bot/api/users/script \
  -H "x-api-key: <your_api_key>"

# Update script
curl -X PUT https://api.canny.bot/api/users/script \
  -H "x-api-key: <your_api_key>" \
  -H "Content-Type: application/json" \
  -d '{"script": "You are a helpful assistant for ACME Corp. Always greet users warmly and direct them to support@acme.com for complex issues."}'

Best Practices

  • Keep it concise — Shorter scripts use fewer tokens and respond faster
  • Be specific — Clear instructions produce better responses
  • Test changes — After updating the script, test with your widget to verify behavior
  • Use guard rails — Combine the script with guard rails for layered safety