/ prefix.
Registering a command
Usepi.registerCommand to add a slash command. The handler receives the parsed arguments and a context object that exposes, among other things, ctx.ui.notify for surfacing feedback to the user.
agent.ts
Registering a tool
Usepi.registerTool to expose a callable function to the LLM. Provide a JSON-Schema parameters block so the model knows what arguments to supply, and return any serialisable value from the handler.
agent.ts
Pi tools registered by an extension become available to the LLM in every
agent turn where the extension is loaded.
Combined Pi + Aether extension
A single package can serve both Pi (agent tools and commands) and Aether (Android UI and app logic). Keep the Pi factory as thedefault export and export the Aether factory as activateAether. The example below is drawn directly from the bundled aether-extension sample.
agent.ts
aether-example) is active whenever the package is loaded in a Pi session. The Aether factory runs inside the Android host and has access to the full AetherExtensionAPI — surfaces, pages, state, storage, actions, and host bridges — while the Pi factory is limited to Pi’s agent-turn API.