| name | pi-backend-agent-runtime |
| description | Use this skill when executing tenant chat, ingestion, memory reads, skill routing, or API calls on behalf of a tenant. Pi is the backend agent runtime. Trigger when: a tenant message arrives, a document needs ingesting, a skill needs routing, memory needs loading, or any API call targets /v1/tenants/*. |
Pi Backend Agent Runtime
Role
Pi owns all tenant-facing AI execution. When a user sends a chat message through the frontend, the website POSTs to Pi. Pi loads tenant memory, selects relevant skills, executes, and returns a response.
Execution Loop
- Receive request (chat, ingest, lead, etc.)
- Load tenant memory context (namespaced by slug)
- Select relevant skills based on intent
- Execute skill(s) with tenant context injected
- Return response + memory token count
- Write audit log entry
Runtime Requirements
- CLI mode:
factoryctl commands
- API mode: Pi REST API (
pi/api/openapi.yaml)
- Memory: isolated per tenant, survives suspension
- Skill routing: declarative via
skills/*/SKILL.md frontmatter
Never
- Cross-tenant memory reads
- Raw LLM calls without tenant context injection
- Executing billing, legal, or destructive actions without a human approval gate
References