env
Declares environment variables the agent requires. This is documentation for the runtime — it validates that declared variables are present at boot and surfaces clear errors when they're missing.
export default defineAgent({
env: {
GITHUB_TOKEN: {
required: true,
description: "Personal access token with repo scope",
},
LOG_LEVEL: {
required: false,
description: "Verbosity level: debug | info | warn",
},
},
})
If a required variable is absent when the agent boots, the runtime throws
before reaching boot.vue. The error includes the variable name and description.
Accessing env in tools and scripts
Use axon.env inside tools and scripts — not process.env directly. This keeps
access tracked and lets the runtime enforce isolation between agents.
// src/tools/github.ts
export async function listIssues() {
const token = axon.env.require("GITHUB_TOKEN")
// ...
}
axon.env.require(key) throws if the variable is missing. axon.env.get(key)
returns undefined instead.
.env files
Values come from .env in the agent folder during local development. In
production, set them as environment variables on the deployment. They are never
committed or included in the published agent bundle.
See Environment for the full isolation model.