Quick Start Guide

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

If you have little experience with Scala or SBT, we recommend that you follow our Getting Started guide 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"
)
)

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 future to make this happen.

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()

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

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.