# Try, go live and pause An agent has three states: - **Draft**: runs only when you try it. - **Live**: starts on its own on its schedule or trigger, and spends the workspace's credits. - **Paused**: stops starting on its own until someone takes it live again. A live agent runs unwatched and costs credits, so only a workspace owner or admin can take one live. ## Before you start [#before-you-start] | To | You need | | --- | --- | | Try a draft | To be able to edit the project | | Run a live agent now | To be able to open the project | | Go live, or make an earlier version live again | To be a workspace **Owner** or **Admin** | | Pause or delete | To be able to edit the project | Anyone else sees "A workspace admin takes agents live." Roles are set in (see [Members](/docs/workspace/members)). The AI in a Studio can never take an agent live or delete one; it can only ask. ## Try a draft [#try-a-draft] **Try it** runs the newest draft once, now. Nothing goes live and no schedule starts. ### Open the agent [#open-the-agent] Open it from or from the project's **Agents** tab. ### Select Try it [#select-try-it] The run opens and you follow each step. On a live agent with draft changes the button reads **Try changes**; the live version keeps running. ### Check the result [#check-the-result] Read its **Result**, and open **Log and files** on any step. If it is not right, change the draft and try again. `klarety agent test` saves the draft from your files and runs it once. Pass inputs with `--input name=value` (repeatable; `7` is read as a number and `true` as a boolean). ```bash klarety agent test daily-summary --project PROJECT_ID --input table=sales.orders ``` ```python from klarety import Nexus nx = Nexus.connect() nx.agents.save("PROJECT_ID", "daily-summary") run_id = nx.agents.start( "PROJECT_ID", "daily-summary", draft=True, inputs={"table": "sales.orders"} ) print(run_id) ``` The answer is the run's id. Follow it with `klarety agent show ` and read what it produced with `klarety agent result `. ## Go live [#go-live] Once live, the agent runs on its own and every run uses the workspace's [credits](/docs/workspace/credits). Try the draft first, and pause it when you no longer need it. ### Select Go live [#select-go-live] On the agent's page, select **Go live**. The app asks "Take daily-summary live?" (with your agent's name) and reminds you it will spend the workspace's credits. ### Confirm [#confirm] Select **Go live** again. The agent is **Live**, its trigger is active, and it moves to **Automatic** (or **On demand**) on the Agents page. The Studio's AI can ask to publish an agent instead. You see a notice, "Your AI asks to publish an agent", with **See it**, **Publish** and **Not now**. Nothing runs until a person selects **Publish**. From code you ask; a person decides in the app. `klarety agent publish` saves the draft and sends the request: ```bash klarety agent publish daily-summary --project PROJECT_ID ``` ```json { "version_id": "...", "asked": true } ``` A workspace owner or admin signed in with their own API key can publish a saved version directly with `nx.agents.publish("PROJECT_ID", "daily-summary", version_id)`. Anyone else gets a `RefusedError` (HTTP 403), because a live agent spends the workspace's credits. ## Run a live agent now [#run-a-live-agent-now] A live agent that starts **When you press Run** waits under **On demand**. Open it and select **Run**. ```bash klarety agent run daily-summary --project PROJECT_ID ``` ## Pause an agent [#pause-an-agent] Select **Pause** and confirm. It stops starting on its own; runs in progress finish. Go live again any time. ```python nx.agents.unpublish("PROJECT_ID", "daily-summary") ``` ## Go back to an earlier version [#go-back-to-an-earlier-version] Every version that went live is kept. Open **Earlier versions**, pick one and select **Make live again**. It replaces the live version at once, and needs a workspace owner or admin. ## Delete an agent [#delete-an-agent] Select **Delete**, then **Delete agent**. It stops and leaves the list. Past runs and their cost stay on record. ## If something goes wrong [#if-something-goes-wrong] - **Go live is not available**: you are not a workspace owner or admin. Ask one to take it live, or ask your Studio's AI to request it so it shows up for them. - **A live agent did not start on time**: check that it is **Live** and not paused. A run that failed shows under **Failing**; open it to see which step stopped and why. - **Draft changes are not running**: changes stay a draft until someone takes them live. The status reads **Live, with draft changes**. ## Where to go next [#where-to-go-next] - [Runs and approvals](/docs/agents/runs) - [Create an agent](/docs/agents/create-an-agent) - [Credits](/docs/workspace/credits)