Skip to content

Enable/disable agent mode for a card

POST
/open/v1/player/agent-mode
curl --request POST \
--url https://api.harperharbor.com/open/v1/player/agent-mode \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "roleId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "multiPassEnabled": true }'

Agent mode uses the saved /player/agent-mode preference or the per-turn agentMode override. Check runtimeEnabled and modelSupported for the selected model. Tool-capable paid models emit durable prepStep progress and agentTurn=true operation status. An interrupted preparation exposes reasonCode=agent_progress_preserved, state=failed_retryable and allowedActions including continue. Resume with a new clientOperationId, the same message, and resumeFromOperationId within 30 days; no second USER message is created. A different model may be sent: the saved progress continues on that model and the remaining work is charged at its rate. Stale or mismatched continuations fail closed; an empty resumeFromOperationId means a fresh turn. History edits invalidate continuations. Credits are reserved incrementally; each execution settles aggregate actual input/output/cache usage once, including usage before a user stop or upstream failure. Internal persistence failures are not charged. A continuation charges only new upstream work. Ordinary /v1/chat/completions remains a caller-managed tool API.

Media typeapplication/json
object
roleId
required
string format: uuid
multiPassEnabled
required
boolean
Examplegenerated
{
"roleId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0",
"multiPassEnabled": true
}

Updated state (same shape as GET).

Media typeapplication/json
object
roleId
required
string format: uuid
multiPassEnabled
required

Per-card switch saved by the player.

boolean
runtimeEnabled
required

Whether the server currently executes agent mode at all.

boolean
modelSupported
required

Whether the evaluated model (query model or the saved one) supports agent mode.

boolean
costWarning
required

Compatibility decision: true for a high estimate (at least 1000 credits) or unknown; false for a known lower estimate. Does not determine Agent support.

boolean
costEstimate

Selected Agent turn estimate at current rates. Observed high is a matched 14-day p90; estimated high is a conservative fallback, not a percentile or maximum. Unknown amounts are null. Actual usage, retries, continuation and separate memory work can cost more.

object
typicalCredits
required

Credits, not a charge limit. Unknown amounts are null.

integer | null
highCredits
required

Credits, not a charge limit. Unknown amounts are null.

integer | null
normalTypicalCredits
required

Credits, not a charge limit. Unknown amounts are null.

integer | null
status
required
string
Allowed values: observed estimated unknown
source
required
string
Allowed values: observed estimated bootstrap unknown
presentation
required
string
Allowed values: none inline confirm
sampleCount
required
integer
reason
required
string
selectionKey
required
string
ruleVersion
required
string
model
string
contextLevel
string
thinkingDepth
string
lengthBucket
string
inputBucket
string
billingRegime
string
pricingFingerprint
string
costRuntimeVersion
string
generatedAt
required
string format: date-time
expiresAt
required
string format: date-time
fixedRuleCredits

Numeric normal fixed-price rule used only to invalidate an estimate when pricing changes; Agent itself is priced by token usage.

integer
costPhase

Which cost estimate applies to the next Agent turn: first until a completed Agent turn has been recorded for cost estimation on this runtime and conversation branch; steady afterwards. A display hint only, not a guarantee about setup state. Omitted when unknown. Does not change selectionKey.

string
Allowed values: first steady
Example
{
"costEstimate": {
"status": "observed",
"source": "observed",
"presentation": "none",
"costPhase": "first"
}
}

invalid_param — bad JSON, empty roleId or missing multiPassEnabled.

Media typeapplication/json
object
error
required

Error code (snake_case) or, for legacy handlers, a free-text/localized message.

string
message

Human-readable sentence. Present only on middleware errors and /me, /me/wallet.

string
retryable

Whether retrying may succeed. Present only on middleware errors, /me, /me/wallet and service/share routes.

boolean
required_context_tier

Only on a first-turn context_capacity_exceeded: the smallest context tier that fits the whole card with room to talk. Save it as context in player settings and resend. Absent when no tier fits.

integer
>= 1 <= 5
required_context_tokens

The token budget of required_context_tier for the selected model, for display.

integer
constant_lore_trim_fits

Only on a first-turn context_capacity_exceeded: whether saving trimConstantLore=true lets the card play at the current tier. Absent on mid-conversation capacity errors.

boolean
credits_needed

Only on insufficient_credits: the credits this turn needs before it can start. Absent when the refusal came without an estimate.

integer
credits_available

Only on insufficient_credits: the credits the wallet could set aside for it.

integer
Examplegenerated
{
"error": "example",
"message": "example",
"retryable": true,
"required_context_tier": 1,
"required_context_tokens": 1,
"constant_lore_trim_fits": true,
"credits_needed": 1,
"credits_available": 1
}

unauthorized.

Media typeapplication/json
object
error
required

Error code (snake_case) or, for legacy handlers, a free-text/localized message.

string
message

Human-readable sentence. Present only on middleware errors and /me, /me/wallet.

string
retryable

Whether retrying may succeed. Present only on middleware errors, /me, /me/wallet and service/share routes.

boolean
required_context_tier

Only on a first-turn context_capacity_exceeded: the smallest context tier that fits the whole card with room to talk. Save it as context in player settings and resend. Absent when no tier fits.

integer
>= 1 <= 5
required_context_tokens

The token budget of required_context_tier for the selected model, for display.

integer
constant_lore_trim_fits

Only on a first-turn context_capacity_exceeded: whether saving trimConstantLore=true lets the card play at the current tier. Absent on mid-conversation capacity errors.

boolean
credits_needed

Only on insufficient_credits: the credits this turn needs before it can start. Absent when the refusal came without an estimate.

integer
credits_available

Only on insufficient_credits: the credits the wallet could set aside for it.

integer
Examplegenerated
{
"error": "example",
"message": "example",
"retryable": true,
"required_context_tier": 1,
"required_context_tokens": 1,
"constant_lore_trim_fits": true,
"credits_needed": 1,
"credits_available": 1
}

generic_error.

Media typeapplication/json
object
error
required

Error code (snake_case) or, for legacy handlers, a free-text/localized message.

string
message

Human-readable sentence. Present only on middleware errors and /me, /me/wallet.

string
retryable

Whether retrying may succeed. Present only on middleware errors, /me, /me/wallet and service/share routes.

boolean
required_context_tier

Only on a first-turn context_capacity_exceeded: the smallest context tier that fits the whole card with room to talk. Save it as context in player settings and resend. Absent when no tier fits.

integer
>= 1 <= 5
required_context_tokens

The token budget of required_context_tier for the selected model, for display.

integer
constant_lore_trim_fits

Only on a first-turn context_capacity_exceeded: whether saving trimConstantLore=true lets the card play at the current tier. Absent on mid-conversation capacity errors.

boolean
credits_needed

Only on insufficient_credits: the credits this turn needs before it can start. Absent when the refusal came without an estimate.

integer
credits_available

Only on insufficient_credits: the credits the wallet could set aside for it.

integer
Examplegenerated
{
"error": "example",
"message": "example",
"retryable": true,
"required_context_tier": 1,
"required_context_tokens": 1,
"constant_lore_trim_fits": true,
"credits_needed": 1,
"credits_available": 1
}