Namespaces

Besides its variables, an agent reads three namespaces the runtime provides: the const, sys and the current command. They are read-only: an agent cannot assign to them.

const

const holds the agent's const: a JSON object of fixed values that is part of the agent meta, like the prompts, and read as const.name. The object is encrypted on its way to and from Search2o Cloud, so the cloud never reads it. An agent cannot assign to const, and each run gets a fresh copy. Validation checks every top-level key the agent reads against the const.

sys

The runtime provides sys. These names are always present:

  • sys.inputs: the inputs the agent was started with, as a dict. For a search the dict is { "query": ... }. A call to execAgent passes any inputs it likes.
  • sys.query: the user's query, the same as sys.inputs['query'].
  • sys.secret[name]: reads a secret by name. Where secrets come from, the environment, a file or your own vault, is on Secret vault.
  • sys.exists(scope, name): whether a variable exists, before reading it. The scope is local, agent, conv, const or allowlist; see Python expressions.

These names are present only when an administrator enables them in the system variables configuration:

  • sys.userEmail: the email address of the user running the agent.
  • sys.userSession: a hash of the user's session, for keying per-session data.
  • sys.serverIp: the agent server's address as seen by the cloud, for logging.
  • sys.cookies: the cookies of the request that started the run.

command

command holds the values of the current command's fields evaluated so far. A field may refer to a field written earlier in the same command as command.field.