Playing Around with Hive

Now that Hive is running, what do you do with it? Briefly, you play around. Here are some things to try

  1. Let's create an agent. Pull down the Agents menu, and select Generic Agents / Event Senders / Create a "Click Me" agent. Hive should respond by creating an agent, putting an icon in the main window, and creating a new window with the words "Click me!" in it.

  2. One agent alone is boring; we can create two and connect them. Create a random dot agent, by selecting Generic agents / Event Receivers / Create a random dot agent. Another agent should pop up with its own window. Now connect them! Right click on the random dot agent's icon, select Connect this agent..., and then left-click on the click me agent. Hive should draw an arrow between the two agents to signify they are connected. If you have a three button mouse, you can also make connections by dragging the middle button from receiver to sender.

    Now that the two agents are connected, they will interact. Click in the click me agent's window. Dots should appear in the random dot agent in response to the events you're sending it. The Hive main window should also animate a red dot to show the message traffic between the agents.

  3. Agents can be graphically configured through Hive's interface. Create a metronome agent (an event sender) and connect it to your random dot agent. Nothing happens, because the metronome agent isn't sending out events. Right click on the metronome agent's icon and select properties. Change the PulseInterval to 2000 (for 2 seconds), click the Set Variables button, and watch the traffic.

  4. You now know most of what there is to know about creating agents. Play around with creating other agents in the menus, and try connecting them up in various ways. Some agents require shadows to run. Try restarting Hive with hive --lazyshadow --visualshadowconfig. This will allow Hive to create shadows for you on the fly, and pop up dialog boxes to configure them. You may not have the devices some of these shadows are expecting.

  5. Hive is a distributed system: things get more interesting when you have multiple Hive cells running. Create two cells, one with hive and one with hive 9393. The first cell is running on the default Hive port (23235), the second is running on the specified port (9393). Agents on the two cells can talk to each other.

    On the first cell you created, create an event sender. On the second cell, choose Cell / Monitor remote cell and type the address of the first cell. The address is displayed in the lower window when the cell starts, and is typically of the form hive://your.machine.name:port.

    Once you click the monitor button, your second Hive cell will begin to "monitor" the second, acting as a user interface for the first cell. A couple of agents should pop up - the event source you created, and the UI agent for the other host.

    Now create an event receiver on the second host and connect it to the event sender. You've just created a link between the two agents across the network! They should work together just as if they were on the same host.

    Typing cell address names is tedious. Hive has a agent called the cell list agent that tries to keep track of other cells in the world. If a cell is known about, its name pops up in the left panel of the UI. You can right click on those cells to make things happen. There is a global cell list agent for the entire Hive network. If that is not working for you, see the --join flag to Hive for instructions on creating your own master cell list.

  6. Hive is not just a distributed agents platform, it is a mobile agents platform. Get the bouncing ball distribution and install it per the instructions in the README. It will walk you through compiling the agents, setting up configuration files in your ~/.hive/ directory, creating two Hive cells, and creating an agent to bounce between them. Enjoy!

This ends our quick tour of what to do with Hive. If you want to do more serious exploration, you will need to roll up your sleeves and play with the code. We do not currently have much written on how to write agents, so you'll have to learn from examples. Read the Hive vision document and the papers about Hive. Then grab the sources, compile them yourself, and start looking at the code for the agents and shadows to get oriented in how things fit together.