Question about dynamic agent creation during cougaar execution

Todd Wright twright at bbn.com
Tue May 29 13:13:02 EDT 2007


daniel domingue wrote:
> Hello to all,
> 
> I hav been going from the cougaar developer guide, and I was wondering
> if cougaar had the possibility of dynamically creating and removing
> agents during execution, and at what level (maybe services?)

This can be done through the blackboard.

Here's an example:
http://cougaar.org/cgi-bin/viewcvs.cgi/core/src/org/cougaar/core/mobility/plugin/AddAgentExamplePlugin.java?rev=1.7&cvsroot=core&content-type=text/vnd.viewcvs-markup

Usage:
   cougaar MyNode.xml

MyNode.xml:
-------------------------------------------------------------------------------
<node name="MyNode">

   <!--
   Enable the mobility infrastructure components, e.g. the 
"RootMobilityPlugin".
   For details, see:
     http://cougaar.cougaar.org/software/latest/OnlineManual/Templates.html
   -->
 
<vm_parameter>-Dorg.cougaar.society.xsl.param.mobility=true</vm_parameter>

   <!--
   Set the node template to single-node.  For details, see:
     http://cougaar.cougaar.org/software/latest/OnlineManual/Templates.html
   For more examples, see the "doc/README.html" in:
     http://build.cougaar.org/auto/HEAD/latest_success/demo-ping.zip
   -->
 
<vm_parameter>-Dorg.cougaar.society.xsl.param.template=single_debug</vm_parameter>

   <!--
   Dynamically add agent 'MyAgent'.

   Requires a local "MyAgent.xml" file, otherwise the agent config will 
default
   to configs/common/DefaultAgent.xml.
   -->
   <component 
class='org.cougaar.core.mobility.plugin.AddAgentExamplePlugin'>
     <argument>MyAgent</argument> <!-- agent name -->
     <argument>MyNode</argument>  <!-- node to add to -->
   </component>
</node>
-------------------------------------------------------------------------------

MyAgent.xml:
-------------------------------------------------------------------------------
<agent name="MyAgent">
   <!--
   An example servlet, just to prove we're reading this file
   -->
   <component class="org.cougaar.core.util.CheckJarsServlet">
     <argument>/showJars</argument>
   </component>
</agent>
-------------------------------------------------------------------------------

To verify it worked, look at:
   http://localhost:8800/$MyAgent/list


Also see:
 
http://www.cougaar.org/pipermail/cougaar-developers/2005-August/001994.html
and the other emails of that thread:
   "Dynamic agent creation & service-blackboard communication"
   http://www.cougaar.org/pipermail/cougaar-developers/2005-August/date.html


Todd

> 
> Thanks also for pointing any documentation I could have missed on this subject
> 
> Cordially



More information about the Cougaar-developers mailing list