Visibility API
Learn how to programmatically show, hide, open, or remove your Foldspace agent using the Visibility API for full UI and state control.
Every call must reference your Agent API Name, which you’ll find in Agent Studio → Setup.
Example Initialization
foldspace("when", "ready", () => {
const agent = foldspace.agent({ /* …common setup… */ });
// Now you can call any of the methods below:
// agent.message(...).open().setViewType("WIDGET").hide()...
});
Open / Close the Agent
Open the agent prompt
foldspace.agent("myproduct-agentic-agent").open();
Close the agent prompt
foldspace.agent("myproduct-agentic-agent").close();
Remove / Destroy
Tear down the agent completely—unmounts the UI, clears its state, and frees resources.
agent("myproduct-agentic-agent").remove();
Visibility Controls
Shows the agent widget
foldspace.agent("myproduct-agentic-agent").show();
Hide the agent widget
foldspace.agent("myproduct-agentic-agent").hide();
Updated 2 days ago