Messaging
Send messages to your agent as if the user typed them, blending conversation, actions, and UI components into your product flows.
Every call references your Agent API Name, found in Agent Studio → Setup.
Initialize the agent
Section titled “Initialize the agent”Call agent methods once the SDK is ready.
foldspace("when", "ready", () => { const agent = foldspace.agent({ /* …common setup… */ }); // Now you can call any of the methods below: agent.message("What actions can you do?");});Send a message
Section titled “Send a message”message(text: string): this
Section titled “message(text: string): this”Send a chat message as if the user typed it into the agent. Returns the agent instance for chaining.
| Parameter | Type | Description |
|---|---|---|
text | string | The message content to send. |
foldspace.agent("myproduct-agentic-agent") .message("Configure brand settings for me");Interpolate runtime values
Section titled “Interpolate runtime values”Because text is a plain string, you can interpolate runtime values and chain other methods such as .open().
const userName = "John";agent("myproduct-agentic-agent") .message(`Hi ${userName}, let's review your pipeline today`) .open();Related
Section titled “Related”- Conversation API: list, search, pin, and manage conversations.
- Agent Event API: listen to agent, UI, and conversation events.