How to Build a Reprogrammable AI Agent
Most AI agents are static - their system prompt is locked at deploy time and changing it means editing configuration and redeploying. In this tutorial you will build a Reprogrammable Agent that breaks this constraint by reading and rewriting its own backstory during a live conversation.
What You'll Build
A conversational AI agent with two self-referential abilities:
- Read Backstory - fetches the bot's current system prompt so the agent knows exactly what rules it is operating under.
- Write Backstory - overwrites the system prompt with new content, persisting the change immediately.
The result is an agent that treats its own instructions as mutable state. Users can ask it to adopt a new persona, add constraints, or completely reinvent its purpose - all within the conversation.
Here is the blueprint you will create:
Prerequisites
- A ChatBotKit account
- Basic familiarity with the ChatBotKit dashboard
Step 1: Create a New Blueprint
- From your dashboard, navigate to Blueprints.
- Click Create to start a new blueprint.
- Give it a name like Reprogrammable Agent and save.
Tip: You can also fork the blueprint above directly from the Reprogrammable Agent example page.
Step 2: Add the Bot Resource
- Open the blueprint designer by clicking Design.
- Add a Bot resource to the canvas.
- Set the following fields:
- Name:
Reprogrammable Agent - Model:
claude-4.6-sonnet(or your preferred model) - Backstory: paste the system prompt shown in the blueprint above - it instructs the agent on how to use its read/write abilities and includes safety guidelines.
- Name:
The backstory is the key piece. It tells the agent it can modify itself and provides a clear procedure: always read the current backstory first, reason about the change, compose a complete replacement, then write it back.
Step 3: Create the Skillset
- Add a Skillset resource to the canvas.
- Name it Self-Programming Toolkit.
- Connect it to the bot by setting the bot's
skillsetIdto reference this skillset.
The skillset acts as a container for the two abilities the agent needs.
Step 4: Add the Read Backstory Ability
- Add an Ability resource to the canvas.
- Configure it:
- Name:
Read Backstory - Description:
Read the current system prompt (backstory) of this bot - Instruction: use the
bot/backstory/readtemplate - Skillset: link to the Self-Programming Toolkit
- Bot: link to the Reprogrammable Agent bot
- Name:
- The
botIdlink is what makes this ability self-referential - it targets the agent's own bot resource.
Step 5: Add the Write Backstory Ability
- Add another Ability resource.
- Configure it:
- Name:
Write Backstory - Description:
Overwrite the system prompt (backstory) of this bot with new content - Instruction: use the
bot/backstory/writetemplate - Skillset: link to the Self-Programming Toolkit
- Bot: link to the Reprogrammable Agent bot
- Name:
- Again, the
botIdreference points back to the agent itself, closing the self-referential loop.
Step 6: Test the Agent
-
Open the agent in Collabo (ChatBotKit's conversation environment).
-
Try these prompts to see the reprogramming in action:
- "What are your current instructions?" - the agent will use Read Backstory and show you its system prompt.
- "From now on, respond only in haiku format." - the agent will read its backstory, compose a new version with the haiku constraint, and write it back.
- "Reset to your default personality." - the agent will rewrite its backstory back to the original.
-
After a write, send a new message to confirm the agent is now behaving according to its updated instructions.
How It Works
The architecture relies on a self-referential loop:
- The bot has a skillset containing two abilities.
- Both abilities reference the bot itself via
botId. - When the agent calls Read Backstory, the platform fetches the bot's current backstory field and returns it.
- When the agent calls Write Backstory, the platform overwrites the bot's backstory field with the new content.
- The change takes effect immediately - the next conversation turn uses the updated backstory.
This pattern is powerful because the agent never needs redeployment. Its instructions live on the platform and the agent can modify them through its own abilities.
Security Considerations
Because this agent can modify its own instructions, keep these points in mind:
- Deploy behind authentication - only trusted users should have access to an agent that can rewrite itself.
- Scope access - in multi-user deployments, consider restricting the Write Backstory ability to admin roles.
- Built-in safeguard - the backstory includes a guideline to refuse changes that would make the agent harmful or deceptive.
Use Cases
- Persona management - let users adjust the agent's tone, verbosity, or domain focus without admin access.
- Progressive refinement - an agent that improves its own instructions over time based on feedback.
- Bootstrap and reset - start with a minimal backstory and let the agent build a rich one through guided conversation.
- AI employee onboarding - a manager bot that programs specialist bots by writing tailored backstories.