Youka is designed to be driven by agents. Every CLI command returns a machine-readable JSON envelope, every write supports idempotency keys, and the public API exposes the same surface with the same semantics. This page collects the operating rules an agent author needs before wiring Youka into a workflow.Documentation Index
Fetch the complete documentation index at: https://docs.youka.io/llms.txt
Use this file to discover all available pages before exploring further.
Get started
If you’re setting up an agent for the first time, install the Youka CLI first, then install the Youka karaoke skill:Prompt your agent
After installing the CLI and skill, you can give your agent a direct task like this:Operating rules
Always use --json
On the CLI, always pass
--json. In the API, always set Accept: application/json. Never parse human output.Always send an idempotency key
Every write should carry a stable idempotency key so retries after a timeout
return the original result instead of duplicating work.
Re-read durable state
Don’t trust stale mutation responses. After a terminal task, re-read the
project or export to get the final state.
Poll with backoff
Start with a 2–3 second interval. Exponentially back off for long jobs.
Respect 429 responses.
Output contract
Every CLI command in--json mode writes exactly one envelope to stdout.
Success:
| Code | Meaning | Retry? |
|---|---|---|
0 | Success. | N/A |
1 | Runtime error (network, API, rendering). | Check error.retryable. |
2 | Invalid input (bad flags, unreadable payload). | No — fix the input. |
End-to-end workflow
The canonical agent workflow is: create a project, wait, export, download the result. Here’s the full pattern with both CLI and SDK implementations.Polling guidance
Most writes return operation handles in the SDK. Preferclient.projects.wait(...) and client.exports.wait(...), and drop to client.tasks.* only when you explicitly need low-level task access.
| Job type | Recommended initial interval | Max wait |
|---|---|---|
| Project create (stems + lyrics sync) | 3 s | 15 min |
| Stem separation only | 3 s | 10 min |
| Lyrics sync only | 2 s | 5 min |
| Export render | 3 s | 30 min |
--wait handles polling for you. On the SDK, the wait helpers use a 2 s interval by default and accept pollIntervalMs.
Idempotency keys
Every create and update operation supports an idempotency key. Rules:- Use a stable, unique, deterministic key per logical mutation. Good:
create-song-${sourceHash}. Bad: a fresh UUID per retry. - Reuse the same key across retries. The server recognizes the replay and returns the original result.
- Keys are scoped per-account and expire after 24 hours.
- If the server returns
IDEMPOTENT_REPLAY_IN_PROGRESS(HTTP 202), the original request is still running. Wait and retry with the same key.
Error recovery
Branch onerror.code and error.retryable. The common cases:
| Code | Cause | Action |
|---|---|---|
INVALID_REQUEST | Request body failed schema validation. | Fix the payload. No retry. |
UNAUTHORIZED | Missing or invalid API key. | Surface to the caller. No retry. |
NOT_FOUND | Resource doesn’t exist or you lack access. | No retry. |
CONFLICT (409) | Version conflict or idempotency collision. | Retry with the same idempotency key. |
TOO_MANY_REQUESTS (429) | Rate limit. | Back off by Retry-After or 30 s. |
INTERNAL_SERVER_ERROR (500) | Transient server failure. | Retry up to 3 times with backoff. |
IDEMPOTENT_REPLAY_IN_PROGRESS (202) | Prior request still running. | Wait and retry with the same key. |
TASK_FAILED | The async task ended in failure. | Surface error.task.error to the caller. No retry. |
TASK_TIMED_OUT | The async task exceeded its budget. | Safe to retry once. |
Discovering mutable fields
Before mutating presets, fetch the preset schema so the model knows the valid fields and value types:youka project settings <id> --body ....
Fetch once per agent session and cache the result.
Parallel agents
When multiple agents run concurrently against the same account:- Scope idempotency keys to both the agent identity and the logical mutation:
agent-${agentId}-create-${sourceHash}. This prevents one agent’s retry from colliding with another agent’s fresh request. - Keep reads unbounded —
GETrequests are cheap and have no side effects. - Use a single queue for
POST /projects/{projectId}/exportsper project if you need ordered export history. Otherwise exports may arrive out of order.
What’s next
- CLI global options — every flag available to agents
- SDK errors — full error class reference
- API async jobs — the polling contract
- API idempotency — the idempotency contract
