psychology

Developing an API for human behavior

What if humans were as programmable as computers?

November 18, 20192 min read

What if humans were as programmable as computers? Imagine being able to shape your own behavior by making API calls. Let's say you wanted to go to the gym every single day. All you would have to do is write the following code.

new_behavior = (
    name="Gym routine"
    frequency="daily"
    type="Boolean"
    target=True
)

self.add_behavior(behavior)
self.save()

That's it! You now have the ability to go to the gym every day thanks to a single API call. How fantastic is that?

What if we'd like to be a more productive programmer? Let's say we want to be in a state of deep focus while we work on challenging programming problems for 8 hours a day. We could create a behavior to let us focus like this.

new_behavior = (
    name="Deep work"
    frequency="daily"
    type="integer"
    target=8
    unit="hours"
)

self.add_behavior(behavior)
self.save()

Bam. Now we can reliably get 8 hours of intense work done per day, while also ensuring we don't skip out on our daily gym routine.

Hmm... that's weird. It turns out programming for 8 hours straight is making us forget to eat food. It's beginning to affect our gym progress. We should probably set a calorie goal to ensure we're sustaining ourself throughout the day. We can also add few macronutrient sub-goals as well to ensure we're eating the right kinds of foods, but for now let's just get some calories in.

calories_behavior = (
    name="Calories"
    frequency="daily"
    type="integer"
    target=3500
)

self.add_behavior(new_behavior)
self.save()

Nice! Now we're a person who's able to go to the gym daily, eat the right amount, and also work for 8 hours a day in a state of intense focus!

What would happen if we tried to push ourselves to the max? What if we made an API call to set our deep_work behavior to 20 hours a day instead of the current 8 hours?

deep_work.set_value(value=20, unit='hours')
deep_work.save()

Uh oh. Something's not right. The first day we were able to work for 20 hours straight (with the aide of copious amounts of caffeine), however the second day we only worked for 6 hours. The third day we worked for zero. That's not right. Perhaps we shouldn't have overclocked the human. Maybe 8 hours is enough.

Say you have to give a pretty important talk in front of a crowd of 5,000 people, and your nerves all over the place. Let's manually override some pretty important chemicals that control our response to stress.

calm_values = (
    heart_rate="50"
    cortisol_level="LOW"
    seratonin_level="HIGH"
    duration="30"
    unit="minutes"
)

# let's run this right before we get on stage to give our talk
self.set_override(calm_values)
self.save()

Now we're cool, calm, and composed for the duration of our talk. We gave it without a hitch, and everyone loved it.

Science Fiction

It turns out there's no API for human behavior (yet). Sorry for getting your hopes up.