Personal automations created with `manage-automations` fail with `missing_credentials` when the AI provider key belongs to the organization
Summary
We use Agent Native. Our AI provider key is saved for the organization, and users don't have personal keys. Chat works for every user. A personal automation created by the agent with manage-automations fails every background run (scheduled or Run now) with missing_credentials:
No LLM provider is connected. Open Settings > Agent > AI providers, then use Builder.io (free tier available) or add a provider key. No delivery was confirmed.
The run fails about 50 ms after it starts, before any model call.
A personal scheduled job created by the legacy manage-jobs tool, by the same user in the same app, runs with the organization's key.
Environment
- Versions:
@agent-native/core,@agent-native/toolkitand@agent-native/agentkit0.209.2 - App: reproduced in a freshly scaffolded app (
create --standalone --template chat), run withagent-native devandAGENT_NATIVE_ENABLE_LOCAL_RECURRING_JOBS=1, and in our internal app (wheremanage-jobsis turned off, so the agent always usesmanage-automations). - Credentials: an OpenAI key saved for the organization under Settings › Agent › AI providers. No personal key.
createAgentChatPluginwithresolveOrgIdreturning the signed-in user's active organization.- Not run on the latest stable release (
0.221.0). The code described under "Relevant code observations" is unchanged there.
Steps and observed behavior
- As a member of an organization with an org-level AI provider key and no personal key, confirm chat works.
- Ask the agent to create a personal scheduled automation, for example: "Create a personal automation called time-check that runs every 5 minutes and replies with the current UTC time. Don't use the web." The agent calls
manage-automationswithaction: "define"andscope: "personal". - Run it (Run now, or wait for the schedule).
- The run fails. Settings › Automations shows the "No LLM provider is connected" message, and the run history has:
{
"automation": "time-check",
"scope": "personal",
"orgId": null,
"status": "error",
"errorCode": "missing_credentials",
"error": "No LLM provider is connected. Open Settings > Agent > AI providers, …"
}
The automation's saved metadata has triggerType: schedule and no orgId.
For comparison, a personal scheduled job created earlier in the same app with manage-jobs has no triggerType and orgId set to the user's organization. Its runs reach the model with the organization's key.
Because the scheduler pauses an automation after repeated missing_credentials failures, the new automation stops running on its own.
Expected behavior
A user's personal automation can run with the same AI provider credentials the user's chat uses, or, if personal automations are meant to need a personal key, that's made clear when the automation is created, and the error doesn't say no provider is connected while one is connected for the organization.
Impact
- In organizations where the provider key is held at the organization level, personal automations created through the current tool can't run at all, while chat and older
manage-jobsjobs work. Users only find out after the first run fails. - The error message points users to AI providers, where a provider already shows as connected.
Relevant code observations
These are static source observations from 0.209.2:
- In
@agent-native/coredist/automations/service.js, defining an automation savesorgId: input.scope === "organization" ? actor.orgId : undefined, so a personal automation is saved without the creator's organization. It savestriggerType. - In
dist/jobs/background-automation-runner.js,resolveBackgroundAutomationIdentitysends any automation withtriggerTypetoresolveAutomationExecutionIdentity. For a resource owned by a user, that returns{ userEmail, orgScope: "personal" }, with noorgId, whether or not the metadata has one. - For metadata without
triggerType(jobs saved bymanage-jobs), the same function usesmeta.orgIdas the run's organization.dist/jobs/tools.jssavesorgId: getRequestOrgId() || undefinedfor those jobs. - With
orgScope: "personal"and noorgId, credential and default-engine lookups (for examplereadDefaultAgentEngineSettingDetailedindist/agent/default-agent-engine.js) read the user's own settings, not the organization's.
Taken together, these suggest background runs of personal automations defined through manage-automations resolve credentials for the user alone, whereas chat and legacy jobs resolve them for the user's organization.
In 0.221.0, service.js still saves orgId only for organization scope, resolveBackgroundAutomationIdentity still branches on triggerType, and resolveAutomationExecutionIdentity still returns orgScope: "personal" for user-owned automations.
Before I open a PR: should personal automations use the org's AI key?
I reproduced this on main (70b1b9f64) with the chat template. The org has an OpenAI key saved, and my test user has no personal key.

The personal automation fails with missing_credentials, and "time check" paused itself after 3 of those failures. The org automation reaches OpenAI and gets a 401 because my key is fake. So org runs find the org key.
Cause:
A user-owned automation runs with orgScope: "personal" (resolveAutomationExecutionIdentity, packages/core/src/automations/service.ts:1513). In that scope resolveOrgScopeForEmail returns no org (packages/core/src/org/context.ts:698), so resolveSecretDetailed never reads the org's keys. The credential trace (DEBUG_CREDENTIAL_RESOLVE=1) shows the difference:
personal run: [resolve-secret] key=OPENAI_API_KEY [email protected] orgId=(none) scope=none hit=false
organization run: [resolve-secret] key=OPENAI_API_KEY [email protected] orgId=8fb1ecd6b3b8404f885a9a6d5fda104e scope=org hit=true
Saving orgId at define time (service.ts:792) doesn't fix it on its own. I tried that: the runner read meta.orgId and still built a personal identity with no org.
Question:
#7602 made personal scope fail closed on purpose, and a test in service.spec.ts pins it ("marks a verified personal owner so background execution can preserve personal scope"). I don't want to loosen that without asking. I see two ways to go:
- Save the creator's org on personal automations and use it for the provider key lookup only, the way chat finds the org key. The rest of the run stays personal.
- Keep personal automations on personal keys.
definewarns when the creator has none, and the run error says personal automations don't use org keys instead of saying no provider is connected.
I'd like to build option 1, starting with a test that fails on main. Does that match what you want, or should I build option 2?