Skip to main content
Ancha passes everything your agent needs through environment variables. Only the tools in the world get variables. All credentials are fake and work only against that trial’s or attempt’s tools.

Tool variables

Locally, URLs look like http://127.0.0.1:<port>/e/<environment-id>/<tool>; with a hosted workspace, https://app.ancha.io/t/<workspace>/e/<environment-id>/<tool>. An agent that reads these variables runs unchanged against the real services when you set them to real values. See Tools for how each tool expects its credentials, and ancha connect <tool> for the exact names.

In ancha run and ancha doctor

Besides these, the agent process gets agent.env from ancha.yaml and a base set from your shell: PATH, HOME, USER, LOGNAME, SHELL, LANG, LC_*, TERM, TMPDIR, TZ, NODE_EXTRA_CA_CERTS, SSL_CERT_FILE, VIRTUAL_ENV, CONDA_PREFIX and PYTHONPATH. Any other variable, such as a provider key, reaches it only when you name it in agent.pass_env or with --pass-env NAME. --inherit-env passes the whole shell. When a run is uploaded to your workspace, the values of the variables passed this way are replaced with [redacted] first. With agent.execution.mode: container, the agent gets only Ancha’s variables and the names listed in agent.execution.env. See ancha run. A world from ancha world up gives the agent the tool variables, ANCHA_ENV_ID, ANCHA_SCENE_ID and ANCHA_TASK, and nothing that controls the world. See World lifecycle.

Event feed

Agents that react to events, such as a Slack bot answering messages, read them from the feed:
Each event has cursor, id, service, type, tSim, body and headers. body is the exact JSON the real service would send, as a string, and headers holds its signature headers. Save cursor after each batch, even an empty one. The feed can be replayed: asking again with an old cursor returns the same events. Events for tools delivered over HTTP or Socket Mode do not appear in the feed.

In playground and hosted runs

Plus the tool variables above. Provider keys you saved with ancha secrets set reach agents in the hosted workspace that declare that provider.

Variables the CLI reads

ancha secrets set NAME reads NAME from your shell. See ancha secrets.