Run your first learning round
Give the local stack a model, run the ticket triage script and watch the learning loop release a better bundle.
In this tutorial you give the local stack a model, then run a script that takes a ticket-routing bundle through the learning loop. The script, in examples/ticket-triage/, uses the API, so the same steps run from CI.
Before you start
You need a source checkout and an API key for an OpenAI-compatible model provider. Any Acclimate service works in place of the local stack if you save the provider on its Model provider page and set the same variables.
Connect a model provider
Learning needs an optimizer on the service and a model provider for the workspace, which serves the task and judge models. On the local stack one provider serves both. Export its base URL, such as https://api.openai.com/v1 for OpenAI, its key, at least two model IDs it serves and the optimizer's model ID, then start the stack.
export ACCLIMATE_PROVIDER_URL='<provider-base-url>'
export ACCLIMATE_PROVIDER_KEY='<provider-api-key>'
export ACCLIMATE_PROVIDER_MODELS='<task-model-id>,<judge-model-id>'
export ACCLIMATE_MODEL='<optimizer-model-id>'
npm run local:uplocal:up points the optimizer at the provider, saves the provider for the local-demo workspace and waits for the executor to verify each model:
Provider Verified at <provider-base-url> (<task-model-id>, <judge-model-id>)The stack keeps these settings for later starts. A provider on 127.0.0.1 also works. See Run learning rounds for the details.
-
In a shell at the root of the checkout, load the stack's client settings. They set
ACCLIMATE_URLandACCLIMATE_WORKSPACE, andTASK_MODELandJUDGE_MODELto the first two allowed models.source .local/stack/env.sh -
In the console, open Machine tokens under Settings in the sidebar, choose Issue token and tick the three rights the script needs: Read content, Write content and Promote releases. The secret is shown once, so export it now.
export ACCLIMATE_TOKEN='<machine-token>' -
Install what your language needs (runtime versions).
npm ci --ignore-scriptsRun the ticket triage script
The starting instructions, in bundle/instructions.md, do not name the queues:
You route support tickets for a small software company.
Read the ticket and reply with the queue it belongs to.The 64 tickets in tickets.csv do, across eight queues. Each row has an input and a short expected, so it becomes an exact-match task.
input,expected
Can you add keyboard shortcuts for moving cards between columns?,feature-request
"I got an email saying my password was changed, but I didn't change it.",security
"I bought the annual plan by mistake, I wanted monthly. Can I get the difference back?",refundsRun the script with the TASK_MODEL and JUDGE_MODEL from env.sh. It never calls the judge model, but the learning settings require one.
npx tsx examples/ticket-triage/loop.tsPublished "Ticket triage" and released version c60f46ed-32f4-47a5-9815-c30b15a8951b on stable.
Imported 64 of 64 rows as tasks.
Checking tasks: 64 still pending.
Checking tasks: 30 still pending.
Checking tasks: 1 still pending.
Admitted 32 evolve tasks and 32 held-out tasks.
Learning is running. Press Ctrl-C to stop watching. Learning continues on the service.
Round 1: scoring incumbent
Round 1: proposing
Round 1: evaluating
Round 1: scoring held out
Round 1 adopted and released version ba6a0ffc-33c7-4d04-a93b-3bfa2690f90e. Evolve tasks: 0% before, 100% for the adopted version. Held-out tasks: 100%.
Round 2: proposing
Round 2: evaluating
Round 2: scoring held out
Round 2 kept the current version (selector-kept). Evolve tasks: 100%. Held-out tasks: 100%.
Round 3: proposing
Round 3: evaluating
Round 3: scoring held out
Round 3 adopted and released version 4cedbe38-48ff-499f-be32-949bb2e8b6a6. Evolve tasks: 100% before, 100% for the adopted version. Held-out tasks: 100%.
Learning is waiting: daily-cap. Next round at 2026-11-25T23:59:54.268843Z.
Released on stable: version 4cedbe38-48ff-499f-be32-949bb2e8b6a6
# instructions.md
You route support tickets for a small software company.
Choose the queue responsible for the customer's primary need, not merely the product or component mentioned. Use this queue directory:
security: Investigate suspected threats, phishing, unauthorized access or exposure; contain compromised credentials or sessions.
account-access: Help a legitimate user gain or recover access, including failures of sign-in, SSO, password reset or verification.
data-privacy: Handle data rights and questions about how customer data is collected, used, shared, retained or erased.
refunds: Return money or reverse a charge. Use this rather than billing when reimbursement is the requested remedy.
billing: Manage invoices, payment methods and billing details, or explain an existing charge.
sales: Evaluate a purchase or expansion, including quotes, plan comparisons, demos and negotiated pricing.
bug: Investigate existing product behavior that fails or produces unexpected, incomplete or duplicate results.
feature-request: Consider a desired new capability, enhancement or roadmap suggestion, rather than repair a malfunction.
Output only the selected queue ID, copied verbatim from before its colon.This real run used gpt-6-luna for tickets and gpt-6.2-astra as the optimizer, with some Checking tasks lines left out. incumbent is the current version when the round started, selector-kept means the optimizer kept it after evaluating the candidates, and daily-cap is the daily round limit.
The starting instructions passed none of the 160 evolve rollouts, because the model invented names such as "Billing Support". In round 1, all five candidates passed every evolve rollout, and the adopted version passed every held-out rollout, on tickets the optimizer never saw. The round ran 1,280 rollouts in 14 minutes (what a round costs). Round 3 adopted a shorter wording that scored the same, and the loop then waited on the script's daily round limit of three.
If the provider answers with rate limits, lower the executor concurrency.
What the script does
Steps are numbered as in the script's comments. Python uses the same names in snake case, such as enroll_learning_loop.
| # | Step | Call | Notes |
|---|---|---|---|
| 1 | Publish the bundle | listBundles, createBundleSetup | Creates the bundle, its first version and a release on stable, unless a bundle with that name exists |
| 2 | Check the model provider | getModelProvider | Needs a verified model provider that allows both models. Only a signed-in administrator can save one. |
| 3 | Turn on learning | getLearningLoop, enrollLearningLoop | Sets the channel, both models and a daily round limit of three. Skipped when learning is on, so console changes survive a rerun. |
| 4 | Import the tickets | importLearningTasks, getLearningImport | Polls until no row is pending. Importing the same bytes again returns the first import. |
| 5 | Wait for admission | listLearningTasks with admission: 'pending' | A machine token gets evolve tasks as items and only a heldOutCount for held-out tasks. |
| 6 | Start | startLearningLoop | Only for a loop that has never run. 409 when a split has fewer than 20 admitted tasks or the service has no optimizer. |
| 7 | Follow the rounds | getLearningLoop | activeRound.state is the current step, rounds the finished rounds, waiting why the loop is idle. |
| 8 | Show the release | resolveAndCache | Reads and verifies the version the next job will run. |
When a round ends
A finished round has a decision of adopted or kept, or a state of failed or stopped with a reason. For an adoption the script prints three scores:
incumbentScore: the current version's evolve score when the round started.evolveScore: the adopted version's evolve score, or the first score for a kept round.heldOutScore: the held-out score of the version on the channel at the round's end.
The loop then runs another round or waits. Codes a script reads lists every code a script can branch on.
Stop and run again
Learning runs on the service, so you can stop the script with Ctrl-C once learning is running and follow the rounds on the bundle's Learning tab. A second run reuses the bundle, its learning settings and the import, and leaves a paused or stopped loop as it is. To pause or stop learning, use the Learning tab, or call pauseLearningLoop or stopLearningLoop.
Adapt it
- Your own tasks. Replace
tickets.csvwith rows ofinputandexpected. Add tasks says how many a first round needs and how a longer answer is graded. - Your own bundle. Put instruction files in
bundle/, skills underbundle/skills/and memory underbundle/memory/. SetACCLIMATE_BUNDLE_NAMEto publish under another name. - Your application. Run jobs on the released version as in Improve a support agent, with the rollout's system prompt and the loop's task model.
Install the SDKs
Install the TypeScript or Python SDK from a source checkout, or from its registry or verified release files once an Acclimate release is published.
Improve a support agent
Answer support requests with a released bundle, improve the bundle with sample tasks and turn a person's correction into a learning task.