Skip to main content
Invoke.fromEnv() reads its configuration from the environment. Set these in your deployment platform’s secrets, or in a local .env file that you never commit.

INVOKE_API_KEY

Required. An agent key (recommended) or your account key, from API in the console. See Authentication.
Keep it server-side. A variable exposed to the browser, such as a NEXT_PUBLIC_ one in Next.js, publishes your key to everyone who loads the page.

INVOKE_API_URL

The Invoke API. Defaults to https://api.invokehq.run. Only set it to point at another Invoke deployment.

INVOKE_WORKSPACE_ID

Which workspace to act in. By default the SDK uses the one workspace the key can see. An agent key sees only its own. Set this when an account key can see several workspaces; the SDK lists them in a ConfigError if you don’t.

INVOKE_AGENT_ID

The agent that acts when a call doesn’t name one. You don’t need it with an agent key, because the key already is an agent.

In code

Every variable has a matching option. Invoke.fromEnv({ agentId: "billing-agent" }) overrides one variable and reads the rest. new Invoke({ apiKey, baseUrl, workspaceId, agentId }) doesn’t read the environment at all.

Next steps