Skip to content

Account status

agent.status() reports whether the account can run a turn right now. It doesn’t start a session.

const status = yield* agent.status()
if (!status.usable) {
// "unauthenticated", "usage_limited" or "spend_limited"
return yield* Effect.log(`Skipping: ${status.reason}`)
}

Each limit window has how much is used and when it resets.

const resets = status.windows
.filter((window) => (window.usedPercent ?? 0) >= 100)
.map((window) => window.resetsAt)
// [DateTime.Utc] for a full five-hour window, say

Some windows cap one model family, such as Fable, and a full one doesn’t make the account unusable: other models still run. usableFor checks the model you’re about to use.

import { usableFor } from "@jpowersdev/effect-agent"
if (usableFor(status, "claude-fable-5-1")) {
yield* dispatch(task)
}

Pass the environment that points the CLI at it.

yield* agent.status({
env: {
CLAUDE_CONFIG_DIR: "/home/me/.claude-work"
}
})
yield* agent.status({
env: {
CODEX_HOME: "/home/me/.codex-work"
}
})