Skip to content

Visibility

Open in ChatGPT Open in Claude

Control your agent’s UI from code: open or close the prompt, show or hide the widget, or tear it down entirely. Use it to wire the agent into your app’s own controls and lifecycle.

Every call references your Agent API Name, found in Agent Studio → Setup.

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 the agent prompt:

foldspace.agent("myproduct-agentic-agent").open();

Close the agent prompt:

foldspace.agent("myproduct-agentic-agent").close();

Show the agent widget:

foldspace.agent("myproduct-agentic-agent").show();

Hide the agent widget:

foldspace.agent("myproduct-agentic-agent").hide();

Tear down the agent completely: unmounts the UI, clears its state, and frees resources.

agent("myproduct-agentic-agent").remove();