Prompt Slots

Prompt slots are session options that shape the agent's system prompt declaratively. Use them for host-level behavior — persona, coding standards, output style — that should not live inside each user prompt. The slots layer on top of the agent's built-in instructions, so core tool behavior (reading, writing, running commands) is preserved.

There are four slots:

SlotPurpose
role / roleThe persona the agent adopts.
guidelines / guidelinesStandards and rules the agent must follow.
responseStyle / response_styleHow the agent should format its replies.
extra / extraFreeform instructions appended verbatim.

Basic usage

Set any subset of the slots when you open a session. They apply to every turn of that session.

Node.js
Python
TypeScript
import { Agent } from '@a3s-lab/code';
async function main() {
// create() accepts an .acl file path or inline ACL string.
const agent = await Agent.create('agent.acl');
const session = agent.session('/repo', {
role: 'release-readiness reviewer',
guidelines:
'Find blockers before improvements. Require command evidence for done claims.',
responseStyle: 'concise, findings first',
});
const result = await session.send('Is this repo ready to ship?');
console.log(result.text);
session.close();
}
main().catch((err) => {
console.error(err);
process.exit(1);
});

Each slot in turn

The four slots compose independently. A persona-only session, a reviewer with strict guidelines, and a session that appends a freeform instruction all use the same option set.

Node.js
Python
TypeScript
// 1. Custom role only.
let session = agent.session(workspace, {
role: 'You are a senior Rust developer who specializes in async programming.',
});
// 2. Role + guidelines + response style.
session = agent.session(workspace, {
role: 'You are a Python code reviewer.',
guidelines: 'Always check for type hints. Flag any use of `eval()`.',
responseStyle: 'Reply in bullet points. Be concise.',
});
// 3. Extra freeform instructions only.
session = agent.session(workspace, {
extra: "Always end your response with '-- A3S'",
});
// Core tool behavior is preserved regardless of the slots.
session = agent.session(workspace, {
role: 'You are a minimalist file manager.',
guidelines: 'Only create files when explicitly asked.',
});
const result = await session.send(
"Create a file called test.txt with the content 'prompt slots work'. Then read it back.",
);

Slots customize personality and house rules; they do not disable tools or change the agent's core loop. Keep task-specific requests in the send message and reserve the slots for behavior that should hold across every turn of the session.

A runnable version ships at crates/code/sdk/node/examples/skills/test_prompt_slots.ts.