📃
AutoMan
  • Introduction
  • Getting Started
    • Installing Prerequisites
    • Tutorial: Obtain Mechanical Turk Credentials
    • Tutorial: Create an AutoMan Project
    • Tutorial: Write and Run Your First App
    • Pro Tip: Use the MTurk Sandbox
    • AutoMan Memoizer
    • Cleaning Up
  • Technical Documentation
    • What is AutoMan?
    • Getting AutoMan
    • Quick Start Guide
    • AutoMan API Reference
    • Papers
  • Press
  • Bugs / Source / Building
  • License
Powered by GitBook
On this page

Was this helpful?

  1. Technical Documentation

Quick Start Guide

Follow this guide if you are _already_ familiar with Scala, SBT, etc.

PreviousGetting AutoManNextAutoMan API Reference

Last updated 4 years ago

Was this helpful?

If you have little experience with Scala or SBT, we recommend that you follow our instead.

In your source file, import the Mechanical Turk adapter (Scala syntax):

import org.automanlang.adapters.mturk.DSL._

After that, initialize the AutoMan runtime with an MTurk config:

implicit val mt = mturk (
  access_key_id = "my key",         // your MTurk "access key"
  secret_access_key = "my secret",  // your MTurk "secret key" 
  sandbox_mode = true               // if true, run on MTurk sandbox
)

and then define your task:

def which_one() = radio(
  budget = 5.00,
  text = "Which one of these does not belong?",
  options = (
    "Oscar the Grouch",
    "Kermit the Frog",
    "Spongebob Squarepants",
    "Cookie Monster",
    "The Count"
  )
)

To access return values, pattern-match on the Outcome's answer field, e.g.,

val outcome = which_one()

// ... do some other stuff ...

// then, when you want answers ...
val answer = outcome.answer match {
  case Answer(value, _, _) => value
  case _ => throw new Exception("Oh no!")
}

Other possible cases are LowConfidenceAnswer and OverBudgetAnswer. If you run out of money during a computation, a LowConfidenceAnswer will let you access to lower-confidence results. An OverBudgetAnswer signals that you didn't have enough money in your budget to begin with.

Cleanup of AutoMan Resources

Note that, due to AutoMan's design, you must inform it when to shut down, otherwise it will continue to execute indefinitely and your program will hang:

mt.close()
automan(mt) {
  ... your program ...
}

We will add more documentation to this site in the near future. In the interim, please see the collection of sample programs in the apps directory.

You may then call which_one just like an ordinary function (which it is). Note that AutoMan functions immediately return an Outcome, but continue to execute asynchronously in the background. AutoMan builds on top of a Scala feature called a to make this happen.

Alternately, you may wrap your program in an automan statement, and cleanup will happen automatically. This feature was by the C# using statement:

Getting Started guide
future
inspired