Glish provides the following functions for manipulating agent values:
    a := create_agent()
    a->hi( "how are you?" )
    whenever a->hi do
        print $value
will print "how are you?".  I am interested in hearing whether
users find create_agent() itself more useful than using
subsequences (§ 7.12, page 
relay(a, "ready", b, "compute")relays each of a's ready events to b, renaming them compute, and
relay(a, "ready", b)relays ready events generated by a to b, keeping the event's name.
    whenever src->* do
        dest->[$name]($value)
    relay( agent1, name, agent2 )
    relay( agent2, name, agent1 )
    relay_all( agent1, agent2 )
    relay_all( agent2, agent1 )
For example, suppose that client a generates both b and c events, and that we want to respond to b events only as long as we haven't received a c event. We could use the following:
    whenever a->b do
        {
        do_b_stuff()
        w := current_whenever()
        }
    whenever a->c do
        {
        do_c_stuff()
        deactivate w    # turn off a->b
        }
This example actually has a bug: if a generates a c event
before any b events, then w will not be defined when
executing the deactivate statement, resulting in an error.  See
the discussion of last_whenever_executed() below for a bug-free
example.
As with current_whenever(), this index has type integer and
is suitable for use in an activate or deactivate statement
(§ 7.5.4, page 
).  The example used above in describing
current_whenever() can instead be written as:
 
    whenever a->b do
        {
        do_b_stuff()
        }
    w := last_whenever_executed()
    whenever a->c do
        {
        do_c_stuff()
        deactivate w    # turn off a->b
        }
    agents := active_agents()
    for ( i in 1:len(agents) )
        {
        a := ref agents[i]
        if ( has_field(a, "locked") )
            a->clear_lock()
        }
will send a clear_lock event to each agent whose agent record
has a locked field (presumably due to a previously-received
locked event).
Note that the system global variable (§ 9.11, page 
) is an
agent, so active_agents() ordinarily returns at least one agent.
    a := create_agent()
    whenever a->foo do print 1
    whenever a->bar do print 2
    b := whenever_stmts(a)
assigns to b a record whose event field corresponds to
the string vector "foo bar", whose stmt field holds
as its first and second elements the indices of the first and second
whenever statements, and whose active field holds two
T values.
The following, for example, turns off every whenever statement associated with some agent's ``warning'' event:
    agents := active_agents()
    for ( i in 1:len(agents) )
        {
        a := ref agents[i]
        w := whenever_stmts(a)
        mask := w.event == "warning"
        deactivate w.stmt[mask]
        }