Get Agent State
The Get Agent State node retrieves the current state of an agent in a specified plugin. It allows you to access and use the agent’s state information in your spell.Inputs
flow(required): The input flow containing the data to be processed.plugin(optional): The name of the plugin where the agent is located. Default is “core”. Choices include:core: The default Magick core plugin.discord: The Discord plugin for integrating with Discord.slack: The Slack plugin for integrating with Slack.
Outputs
flow: The output flow with the retrieved agent state added.state: The current state of the agent as an object.
Configuration
This node does not have any additional configuration options.Usage
- Connect the input
flowto the node from which you want to retrieve the agent state. - (Optional) Select the desired
pluginfrom the dropdown menu if the agent is not in the default “core” plugin. - Connect the output
flowto the next node in your spell. - Use the
stateoutput to access the agent’s current state information in subsequent nodes.
Example
Here’s an example of how to use the Get Agent State node in a spell:state output is then passed to a Code node, which logs the agent’s name to the console. Finally, the Send Message node sends a message containing the entire agent state object.
Best Practices
- Use the Get Agent State node when you need to access and utilize the current state information of an agent in your spell.
- Make sure to select the correct
pluginif the agent is not in the default “core” plugin. - Use the
stateoutput to access specific properties of the agent state object in subsequent nodes.
Common Issues
- If the specified
pluginis not found or the agent does not exist, the node will output an emptystateobject. - Ensure that the agent has a valid state before using this node, otherwise, the
stateoutput may be undefined or empty.
