Prompts
Create versioned prompt templates, resolve Liquid variables, and apply prompts to agents
The Prompts module manages your workspace prompt library. Templates support Liquid variables, version history, and agent linking. MCP clients discover the same prompts via prompts/list.
Setup
import { Chanl } from '@chanl/sdk';
const chanl = new Chanl({
apiKey: process.env.CHANL_API_KEY,
});List and get
const { data: prompts } = await chanl.prompts.list({
status: 'active',
category: 'support',
});
const { data: prompt } = await chanl.prompts.get(promptId);Create and update
const { data: created } = await chanl.prompts.create({
name: 'Support Greeting',
content: 'Hello {{customer_name}}! How can I help?',
category: 'support',
variables: [
{
key: 'customer_name',
required: true,
},
],
});
// PATCH — content changes create a new version
await chanl.prompts.update(created.id, {
content: 'Hi {{customer_name}}, thanks for reaching out.',
});Versions and revert
const { data: versions } = await chanl.prompts.getVersions(promptId);
await chanl.prompts.revert(promptId, { version: 2 });Resolve variables
const { data } = await chanl.prompts.resolve(promptId, {
variables: {
customer_name: 'Alice',
},
});
console.log(data.content);
console.log(data.unresolvedVariables ?? []);Apply to an agent
await chanl.prompts.apply(promptId, {
agentId: '507f1f77bcf86cd799439011',
syncToPlatform: true,
});Python
import asyncio
from chanl import AsyncChan
async def main():
async with AsyncChan(api_key="chanl_key_...") as client:
prompts = await client.prompts.list(status="active")
resolved = await client.prompts.resolve(
prompt_id,
variables={"customer_name": "Alice"},
)
print(resolved)
asyncio.run(main())CLI
chanl prompts list
chanl prompts create -f prompt.json
chanl prompts revert <id> --to-version 2
chanl prompts resolve <id> -f vars.json
chanl prompts apply <id> --agent <agent-id>See CLI reference and MCP prompts.