Appearance
Platform Capabilities
Platform capabilities are server-side services available in actions via ctx.platform.call(). They provide AI, blob storage, env vars, and cross-store calls.
Platform capabilities are only available in actions, not mutators. Mutators run on both client and server, so they can't access server-only services. If you need an AI call or external API triggered by a client interaction, use a mutator to create a placeholder, then ctx.enqueueAction(...) to do the server-only work.
Available Services
| Service | Example | Description |
|---|---|---|
poe.botStream.open | call("poe.botStream.open", { botName, queryRequest }) | Open a trusted Poe Bot API stream without exposing API keys to app code |
systemTools.list | call("systemTools.list", {}) | List tools the LLM can call |
systemTools.call | call("systemTools.call", { toolName, toolInput }) | Execute a tool |
env.get | call("env.get", {}) | Get environment variables |
store.callAction | call("store.callAction", { storeTypeId, storeInstanceId, actionName, actionInput }) | Call an action on another store |
store.getSchema | call("store.getSchema", { storeTypeId }) | Get another store's schema |
blob.put | call("blob.put", { content: btoa("hello") }) | Store content (base64) |
blob.get | call("blob.get", { hash }) | Retrieve stored content |
blob.has | call("blob.has", { hash }) | Check if a blob exists |
apps.publish | call("apps.publish", { handle, files }) | Publish an app from inline file contents (files is Record<string, string>, must include index.html) |
setSpaceTitle | call("setSpaceTitle", { title: "Alice vs Bob" }) | Set the user-facing title of the current app instance (null clears the rename). Fans out to every member's manager. |
Usage in an Action
typescript
import type { InferActionHandlers, PlatformCaller } from "poe-tiles-sdk/v1/backend.js";
type TodoActions = InferActionHandlers<typeof todoSchema, PlatformCaller>;
const actions: TodoActions = {
generateWithAI: async (ctx, input) => {
const stream = await ctx.platform.call("poe.botStream.open", {
botName: "GPT-4o-mini",
queryRequest: {
version: "1.0",
type: "query",
query: [{ role: "user", content: input.prompt }],
user_id: "",
conversation_id: crypto.randomUUID(),
message_id: crypto.randomUUID(),
},
});
await stream.cancel(); // parse the stream in real AI-driven actions
const { hash } = await ctx.platform.call("blob.put", { content: btoa("cached result") });
// ...
},
};Pass PlatformCaller as the second type parameter to InferActionHandlers for full autocomplete on ctx.platform.call().
Testing
typescript
import { createMockPlatformCaller } from "poe-tiles-sdk/v1/test-utils.js";
// Unit tests
const runner = createLocalStoreFunctionRunner({
...myBackendConfig,
createPlatformCaller: () => createMockPlatformCaller(),
});
// E2E tests
const server = new TestServer({
createPlatformCaller: () => createMockPlatformCaller(),
});