Integration between personal sovereign AI agents and client applications
The AI Companion API enables seamless integration between personal sovereign AI agents and client applications, providing users with personalized AI assistance while maintaining data sovereignty and privacy.
The AI Companion API provides a standardized interface for connecting personal sovereign AI agents with various client applications. Each companion agent operates through a dedicated Matrix bot service that connects to the user’s Matrix room via the Matrix MCP (Matrix Client-Server Protocol) interface.
The Matrix MCP interface is currently in development. This documentation serves as a placeholder and will be updated as the implementation progresses.
// Send message to companionasync function askCompanion(question) { await matrixClient.sendMessage(companionRoom.roomId, { msgtype: 'm.text', body: question });}// Example usageaskCompanion('What's the weather forecast for today?');
4
Handle Responses
Copy
Ask AI
// Process companion responsesfunction handleCompanionResponse(response) { // Parse response format const { text, actions, attachments } = parseResponse(response); // Update UI or trigger actions updateUI(text); processActions(actions); displayAttachments(attachments);}
import { IxoCompanion } from '@ixo/companion-sdk';// Initialize companion in web appconst companion = new IxoCompanion({ matrixServer: 'https://matrix.ixo.world', credentials: { userId: '@user:ixo.world', accessToken: 'YOUR_ACCESS_TOKEN' }});// Connect and interactawait companion.connect();// Send message and get responseconst response = await companion.ask('How can I optimize my investment portfolio?');// Display in UIdocument.getElementById('response').textContent = response.text;