Example: Sender-Buffer-Receiver system

Agent S (sender) puts sequentially valueless signals to the buffer (agent B) and agent R (receiver) gets such signals from the buffer. Agent B offers two procedures (services, ports) to connected agents.

agent S {
  loop {                -- 1   comments contain steps numbers
    out put;            -- 2
  }
}

agent B {
  i :: Int = 0;
  proc (i == 0) put { 
    in put;              -- 1
    i = 1;               -- 2
    exit;                -- 3
  }
  proc (i /= 0) get { 
    out get;             -- 4
    i = 0;               -- 5
    exit;                -- 6
  }
}

agent R {
  loop {                 -- 1
    in get;              -- 2
  }
}