Const
The const is a JSON object of fixed values for one agent: product names, tone of voice, thresholds, lists of categories, example texts, and any text that is sensitive. The agent reads it as the read-only const namespace. The const is part of the agent meta: it is edited with the draft, validated with it, published with it, and stored encrypted.
{
"product": "Acme Router X2",
"language": "français",
"maxItems": 5,
"categories": ["billing", "outage", "setup"],
"support": { "email": "help@example.com", "hours": "9-17 CET" }
}"output": "{ f'Contact {const.support[\"email\"]} between {const.support[\"hours\"]}.' }"Keep values that differ between agents, or that you want to change without touching the agent's logic, in the const rather than written into the definition. Keep sensitive text there too, whether a command or a prompt uses it: the definition and the prompts are stored in the cloud in plain form, the const is stored encrypted. Use top-level keys that are valid names, letters, digits and underscores, so they can be read as const.name.
Where you can use it
Anywhere an expression is allowed: in var, if, for (for example "iter": "{ const.categories }"), api bodies, output, function arguments, and prompts:
| Name | chat |
| System | { 'You are the support assistant for ' + const.product + '. Answer in ' + const.language + '.' } |
| User | { sys.query } |
sys.exists('const', 'maxItems') tells you whether a key is present.
Read-only, and fresh for every run
An agent cannot set const: var cannot target it. Each run gets its own copy. When an agent changes a list or dict it read from the const, for example by adding a key to a local variable that holds const.support, that change stays within that run. The next run, for any user, sees the const exactly as it was published.
Encrypted
The agent server encrypts the const before it leaves for Search2o Cloud, the same way it encrypts an agent's description. The cloud stores and returns only the encrypted value. The editor shows it decrypted, so you edit plain JSON.
With end-to-end encryption, the key never leaves your organization and the const cannot be read outside your agent servers. That makes the const the place for text a prompt or a command needs but that must not be readable outside your organization, such as internal instructions, names or wording. The prompt reads it as { const.name }, and the prompt text that is stored in the cloud holds only the reference.
Validation
When a draft is validated:
- Every
const.NAMEthe agent reads, in commands or in prompts, is checked against the const's top-level keys. A missing key is reported where it is used:'nokey' is not in the agent's const.Keys are case-sensitive. - An agent that reads
const.anythingwith no const, or an empty one, gets the same report for each read. - A const that is not a JSON object, for example a list, or that is not valid JSON, is reported at
const.
Only top-level keys are checked before the run. A missing nested key, such as const.support['phone'], fails when that expression runs: Could not evaluate the Python expression at ...: 'phone'. Use .get() for a nested value that may be absent.
Size
The encrypted const may be up to 50,000 characters. Encryption makes text about a third longer, and characters outside ASCII take more room, so a const of plain ASCII text fits up to roughly 37,000 characters, less when it holds accented or other non-ASCII characters. A const that is too long is refused when you save it: The const is too long. Encrypted, it is 53,541 characters, over the 50,000 that can be stored. Encryption adds about a third, more for characters outside ASCII.
Changing the const of a published agent
Like the prompts, the const belongs to the draft: make a draft from the agent, change the const, validate and publish. A publish that changes only the const keeps the agent's version, and the agent's next run uses the new values. See Publishing.
Putting it together
A support agent that answers in the customer's language, about the right product, with or without a photo of the device. The photo, when there is one, arrives as a base64 input named photo alongside the query.
{
"functions": {
"main": {
"commands": {
"if": {
"condition": "{ 'photo' in sys.inputs }",
"then": { "llm": { "profile": "claude_haiku", "prompt": "with_photo" } },
"else": { "llm": { "profile": "claude_haiku", "prompt": "chat" } }
},
"output": "{ result }"
}
}
}
}Prompts
| Name | chat |
| System | { 'You support ' + const.product + '. Reply in ' + const.language + ', in at most ' + str(const.maxItems) + ' sentences.' } |
| User | { sys.query } |
| Scope | agent |
| Doc | Text questions from the customer. |
| Name | with_photo |
| System | { 'You support ' + const.product + '. Describe what you see, then answer. Reply in ' + const.language + '.' } |
| User | { [sys.query, {'contentType': 'image', 'data': sys.inputs['photo'], 'mimeType': 'image/jpeg'}] } |
| Scope | agent |
| Doc | Questions that come with a photo of the device. |
{
"product": "Acme Router X2",
"language": "français",
"maxItems": 5
}- Validation checks that
const.product,const.languageandconst.maxItemsexist. - Both prompts use the
agentscope, so this agent remembers its own conversation with the customer, and other agents in the conversation keep theirs. - Changing the product or the language later is a const-only publish: the agent's logic stays as it is, and the next run picks the new values up.

