class Agent
Main agent class
The Agent
class has represents a currently running agent. It corresponds 1:1 to an <Agent>
tag in your code.
You do not construct the Agent
class yourself. It is created for you when your <Agent>
gets rendered by the runtime.
To get a handle to the Agent
class, use one of the following:
useAgent
hook
- Any component nested within and
<Agent>
can call theuseAgent
hook to get a handle to the underlyingAgent
class.
handler
callback
- Each
handler
in your agent (such as<Action handler={(event) => {/* ... */}}>
or<Perception handler={(event) => {/* ... */}}>
) has anagent
key on theevent.data
. You can use this for convenient access to the currently runningagent
. e.g.
useRef
hook
- Every
<Agent>
has an internalref
that resolves to theAgent
instance. You can access it the usual way using React'suseRef
:
When you have a handle to your agent, you can access its methods.
Methods
TBD