Build
AI Studio
Every AI asset kind is workspace-scoped, permission-gated metadata — no parallel systems. One orchestrator, runAgentTurn(), runs every Agent turn identically across the Playground, Test Cases and every live channel.
Prompt Library
A Prompt is a versioned system prompt — draft, publish, roll back. Modules and Agents resolve a published prompt by name via ctx.prompt(name) (see the Module SDK), falling back to their own inline prompt if nothing has been published yet — never a hardcoded, workspace-specific prompt.
Knowledge Base
A Knowledge Source (document, website, FAQ or note) is chunked, embedded and indexed for retrieval. Every module and Agent shares one retrieval implementation, searchKnowledge() — modules call it via ctx.knowledge(), Agents call it as part of runAgentTurn()'s RAG pass. No module or Agent owns its own knowledge store.
Agents
An Agent combines a prompt, knowledge sources, tools and escalation rules into one versioned, testable configuration (an AgentVersion). Publishing a new version is how you ship a behavior change — the Playground and Test Cases run against the same published version live channels do.
Memory
Each turn loads prior turns from ConversationMemory, keyed by agentId + sessionId, and persists the updated window back afterward — trimmed to the Agent version's configured memorySettings.windowTurns. Test Cases can override this with seedTurns instead of reading real history.
Tool calling
runAgentTurn() runs aiComplete() in a tool-calling loop (max 3 iterations), executing calls via runTool() — permission-checked against the caller's role, audit-logged, and never throws (a bad tool call degrades to an error result instead of failing the turn).
| Tool | Permission | Side-effecting |
|---|---|---|
| search_knowledge | manage_knowledge_base | no |
| create_ticket | manage_tickets | yes — real Ticket in execute mode |
| run_workflow | manage_bots | yes — calls workflow-core.ts::runExecution directly |
| call_rest_connector / github_request / send_email / trigger_webhook | manage_ai | yes — thin wrappers over callConnector() |
Connector-backed tools compose identically — one ToolDefinition file plus one registry line, zero changes to runTool()'s contract. See Connectors.
AI Runtime
runAgentTurn() is the one orchestrator every Agent turn goes through — there is no platform-specific AI logic anywhere; channels only ever produce a NormalizedUpdate and receive a ctx.send() call back. aiComplete() underneath is the sole chokepoint for provider fallback/circuit-breaking, Enterprise provider/model allow-lists, plan token-budget limits, and usage logging — applied automatically to every caller, live or simulated.
runAgentTurn() shape
runAgentTurn({
workspaceId, agentId, agentVersionId, sessionId,
userMessage, role, userId, mode, customerId?,
}) => Promise<{ answer, transcript, inputTokens, outputTokens, costMicros }>mode: "simulate" (Playground, Test Cases) makes side-effecting tools report what they would do instead of writing a row; mode: "execute" (live channels) takes real actions.
AI Marketplace
Every AI asset kind, and whether it's installable today:
| Prompt | Versioned system prompt — draft, publish, roll back. | Available |
| Knowledge Source | Document, website, FAQ, or note — chunked, embedded and indexed for retrieval. | Available |
| AI Agent | Configured assistant combining a prompt, knowledge sources, tools and escalation rules. | Available |
| Tool | Permission-scoped action an agent may invoke (workflow, CRM, commerce, API, connector). | Available |
| Memory Store | Session/customer/workspace conversation memory with configurable retention. | Planned |
| Embedding Index | The embedding provider + vector backend pairing backing a workspace's Knowledge Base. | Available |
| Connector | External API/OAuth/webhook integration an Agent's tools can call (see AI_CONNECTORS.md). | Available |
| Industry Template | Curated bundle of an Agent + Knowledge + Prompt (and optional Connectors) for one vertical. | Available |
Agents, Prompts, Knowledge Packs, Tools, Connectors and Industry Templates all publish through the identical submission/review pipeline as ordinary modules — tagged by assetType instead of a parallel catalog. See AI Asset SDK for the submission form, and Marketplace for the review/revenue mechanics.