Debugging a Soul
The Soul interface supports connecting the web-based debugger. Add the debug
and token
keys to your new Soul(...)
.
You can find your API Key (to use as the token) by using the CLI command: npx soul-engine apikey
import { Soul, said } from "@opensouls/soul"
// Create a new Soul instance with a new unique identifier
const soul = new Soul({
organization: "opensouls",
blueprint: "samantha-provokes",
token: "your api key", // npx soul-engine apikey
debug: true, // this is new
})
// Listen for responses from the soul
soul.on("says", async ({ content }) => {
console.log("Samantha said", await content())
})
// Connect the soul to the engine
soul.connect().then(async () => {
// Send a greeting to the soul
soul.dispatch(said("User", "Hi!"))
})
// This will print out something like:
// CONNECTED TO SOUL. DEBUG HERE: https://souls.chat/chats/opensouls/samantha-provokes/111-dddd-156a-4927-83ce-01223c
Visiting the URL printed to your console will give you the debug interface where you can chat, and see the incoming and outgoing InteractionRequest
objects and Perception
objects.
š§
If you start a soul without debug turned on, you cannot turn it on later. Similarly, if a soul is started with debug mode turned on, you cannot turn it off. We recommend developing your application with debug turned on and releasing a different soul to production, with debug turned off.