Agent Based Programming

Note: this blog post has a deeper discussion of some the concepts introduced here.

An agent is like a small program that has one job and is always running. An Embrio project is made up of a number of connected agents that work together to solve the control problem.

Agents in Embrio are implemented visually by connecting nodes into isolated groups.

In regular programming there are many types of data that can be passed around. In Embrio the vast majority of communication between nodes and agents happens with two connection types: activation and trigger.

An activation connection is a real value between 0 and 1 (or sometimes between -1 and 1). Most of what an agent does is turn on or off other agents. It does this by passing a value to the other agent's activation or suppression input. Passing a positive value to an agent's activation input turns the agent on, while passing a value to its suppression input turns it off.

A node or agent can have a trigger output which fires when something happens (often when an input value exceeds some threshold or falls within a range). The trigger can connect to an input on another node or agent which will do something (like turn on or off a switch) when the trigger fires.

There are 3 major types of jobs that an agent can do; perception, action, and control.

A perception agent generally exposes an activation output that turns on when some state is true. A simple perception agent could monitor a button and set its activation value to 1 when the button is pressed (or better yet fire a trigger). Or its activation value could be the value of a potentiometer or pressure or distance sensor. Perception agents can directly monitor the pins on a microcontroller for input in the world, or they could monitor other agents. A more high level perception agent could monitor when there has been no user interaction for some time interval and output a 1 when this interval has passed or 0 when there has recently been interaction.

An action agent does something. A simple one could turn on an LED or a motor by setting their pin values on the microcontroller. Higher level action agents could turn on multiple other agents to do some job. Action agents generally have an activation and suppression input which other agents use to turn them on or off.

A control agent links the activation output of a perception agent to the activation input of an action agent.

An agent is always updating, at a refresh rate appropriate to the job of the agent as determined by the user. For example an agent that sends values to a motor would update much more frequently than an agent that measures the ambient temperature. All of the agents in the control system constantly update in parallel, connected in a way that solves the control problem.

View discussion page on forum