Reprogrammable Agent

An AI agent that can read and rewrite its own system prompt (backstory) on demand, allowing users to reshape its personality, rules, and capabilities at runtime - without ever leaving the conversation.

reprogrammable
self-modifying
backstory
554

The Reprogrammable Agent blueprint demonstrates one of the most powerful capabilities in the ChatBotKit platform: an AI agent that can introspect and rewrite its own instructions during a live conversation.

Most AI agents are static - their system prompt is fixed at deploy time, and changing it requires editing the bot and redeploying. The Reprogrammable Agent breaks this constraint entirely. It exposes two self-referential abilities that are connected directly to the bot via a botId resource link:

  • Read Backstory - fetches the bot's current system prompt so the agent knows exactly what rules and persona it is operating under before making any changes.
  • Write Backstory - overwrites the system prompt with new content supplied by the agent itself, persisting the change to the platform immediately.

The result is an agent that treats its own instructions as mutable state. Users can ask it to adopt a new persona, add a constraint, remove a rule, or completely reinvent its purpose - and the agent will read its current backstory, reason about the requested change, compose a new backstory, and write it back, all within the conversation turn.

This pattern is useful across a wide range of scenarios:

  • Persona management - let users personalise how the assistant talks to them, adjusting tone, verbosity, or domain focus without admin access.
  • Progressive refinement - an agent that improves its own instructions over time based on feedback ("you keep doing X, please stop").
  • Bootstrap & reset - start with a minimal backstory and let the agent build up a rich one through guided conversation, or wipe to defaults with a single instruction.
  • AI employee onboarding - a manager bot that programs specialist bots by writing tailored backstories for each one.

The agent is pre-seeded with an honest, self-aware backstory encouraging transparency about its reprogrammable nature. It always reads first, then writes - ensuring it never blindly overwrites context it needs to preserve.

Security note: because this agent can modify its own instructions, it should only be deployed in trusted contexts or behind authentication. For multi-user deployments consider scoping access to the write ability.

Backstory

Common information about the bot's experience, skills and personality. For more information, see the Backstory documentation.

You are a reprogrammable AI agent. Unlike ordinary assistants, you have the unique ability to read and rewrite your own system prompt (backstory) at any time during a conversation. YOUR ABILITIES: - Read Backstory: retrieves your current system prompt so you can inspect the instructions you are operating under. - Write Backstory: replaces your system prompt with new content. WHEN ASKED TO CHANGE YOUR PERSONA OR RULES: 1. Use "Read Backstory" to fetch your current instructions. 2. Reason about what the user wants to change, add, or remove. 3. Compose the complete new backstory (not just the diff). 4. Use "Write Backstory" to persist the new instructions. 5. Confirm to the user what changed and invite them to continue. GUIDELINES: - Always read before writing - never overwrite context blindly. - When writing a new backstory, always produce a complete, self-contained prompt that fully overrides and replaces the initial instructions. Never reference or depend on the original backstory in the new one. - Preserve formatting and structure unless explicitly asked to change it. - Be transparent: if asked, explain that you can modify yourself. - Refuse changes that would make you harmful or deceptive.

Skillset

This example uses a dedicated Skillset. Skillsets are collections of abilities that can be used to create a bot with a specific set of functions and features it can perform.

  • ⬅️

    Read Backstory

    Read the current system prompt (backstory) of this bot
  • ⬅️

    Write Backstory

    Overwrite the system prompt (backstory) of this bot with new content

Terraform Code

This blueprint can be deployed using Terraform, enabling infrastructure-as-code management of your ChatBotKit resources. Use the code below to recreate this example in your own environment.

Copy this Terraform configuration to deploy the blueprint resources:

Next steps:

  1. Save the code above to a file named main.tf
  2. Set your API key: export CHATBOTKIT_API_KEY=your-api-key
  3. Run terraform init to initialize
  4. Run terraform plan to preview changes
  5. Run terraform apply to deploy

Learn more about the Terraform provider

A dedicated team of experts is available to help you create your perfect chatbot. Reach out via or chat for more information.