Skip to content

Lesson 6: Going Live

Your email triage machine works in Koda. You run it manually and it classifies, routes, and acts. But you are not going to type /run email_triage 150 times a day.

This lesson deploys your machine as a live endpoint and schedules it to run automatically.

Deploy as an API

One command:

/deploy email_triage

This creates a live HTTP endpoint. Any system can call it:

POST https://your-org.mashin.live/api/email-triage/run
{
"subject": "URGENT: Client escalation",
"sender": "vp@client.com",
"body": "We need to talk immediately."
}

The response comes back with the classification, routing decision, and what action was taken.

By default, the endpoint requires an API key. You can also make it public or protect it with SSO:

/deploy email_triage --auth public
/deploy email_triage --auth sso

Schedule It

To check email automatically every 5 minutes:

/schedule email_triage --cron "*/5 * * * *"

That is a cron expression. */5 * * * * means “every 5 minutes.” Some common schedules:

ScheduleCronUse case
Every 5 minutes*/5 * * * *Email triage, monitoring
Every hour0 * * * *Report generation
Daily at 9am0 9 * * *Morning briefing
Weekdays at 6pm0 18 * * 1-5End-of-day summary

Once scheduled, the machine runs on its own. You do not need to be in Koda.

Monitor What It Does

After deploying, you can see:

Recent runs:

ask Koda: show me the last 10 runs of email_triage

Cost over time:

/cost email_triage

This shows estimated daily, weekly, and monthly cost based on actual usage.

Failures: If a run fails (Teams is down, API error, unexpected input), mashin creates a signal. You will see it in Koda the next time you open it:

[!] email_triage failed 3 times in the last hour
Last error: Teams API returned 503
Affected: 3 emails routed to notify_team

Signals show up automatically. You do not need to check logs.

Pause and Resume

If something goes wrong:

ask Koda: pause the email_triage deployment

The endpoint stops accepting requests. No emails are processed. Fix the issue, then:

ask Koda: resume email_triage

What is Tracked

Every deployed run records:

  • Input and output
  • Execution time per step
  • Token usage and cost
  • Which models were called
  • Which external systems were contacted
  • Success or failure with error details

This is not logging you added. It is the governance record that every machine produces automatically. When your manager asks “what did this thing do last Tuesday at 3pm?” you have the answer.

The Cost Reality

At 150 emails/day using Haiku for classification:

  • Classification: ~$0.05/day ($1.50/month)
  • Teams notifications: $0 (no AI cost)
  • Planner task creation: $0 (no AI cost)
  • Total: about $1.50/month

The execution trace breaks this down per run, per step, per model. No surprises.

What Comes Next

Your machine is live and running automatically. But how do you know it is working correctly? What if the classification accuracy drifts? What if an edge case slips through?

Next lesson: adding goals and tests. A contract that defines success, with automated tests that catch problems before your users do.

Next: Goals and Tests →