diff --git a/content/docs/ai/actions-as-tools.mdx b/content/docs/ai/actions-as-tools.mdx index b2235e650e2..8728ec13625 100644 --- a/content/docs/ai/actions-as-tools.mdx +++ b/content/docs/ai/actions-as-tools.mdx @@ -35,11 +35,20 @@ the caller's identity forwarded. **ObjectOS** layers an in-product chat *runtime* -on top of these same actions: it generates one `action_` tool per action +on top of these same actions: it generates one tool per exposed action and adds a server-side approval queue. Both the open MCP path and the ObjectOS runtime gate on the same `ai.exposed` opt-in. Those pieces are called out below. The open path — the same Action reachable as an MCP tool by your own AI — is the default. + +An object-bound Action's tool is `action___` (the object +name, two underscores, the action name), and a top-level Action's, bound to no +object, is `action_`. A qualified name longer than 64 characters is +shortened to its head plus a hash, so take the exact spelling from +`actionToolName` in `@objectstack/spec/ai` rather than writing a long one by +hand. The older `action_` spelling of an object-bound Action still +resolves, but to every exposed Action of that name, whatever its object. +`action_*` keeps its meaning: every exposed Action. ## The open path: Actions over MCP @@ -247,7 +256,7 @@ with the app's own authority. **ObjectOS** — the in-product chat runtime adds a *server-side* -approval queue for its own `action_` tools: a gated tool call is +approval queue for its own action tools: a gated tool call is persisted as pending and returned to the model as `{ status: 'pending_approval', … }` instead of executing, and only the person the call ran as decides it in the **AI Pending Actions** inbox, on their own @@ -303,7 +312,7 @@ resolves the authenticated principal from `req.user` — both cookie session `aiService.chatWithTools(...)` as `toolExecutionContext: { actor, conversationId, environmentId }`. That threads the same RLS context through the runtime's built-in data tools and its -`action_` tools. From a custom server route you pass the actor explicitly. +action tools. From a custom server route you pass the actor explicitly. Omitting `toolExecutionContext` (or its `actor`) is **not** a system fallback: the contract fails closed and data tools run as an unauthenticated, RLS-on principal that sees nothing (#2991). Trusted internal callers (cron jobs, diff --git a/content/docs/ai/agents.mdx b/content/docs/ai/agents.mdx index bd6bf4ef70c..79be5324fe0 100644 --- a/content/docs/ai/agents.mdx +++ b/content/docs/ai/agents.mdx @@ -198,8 +198,8 @@ reaches an agent only when their surfaces match Per [ADR-0109](https://github.com/objectstack-ai/objectstack/blob/main/docs/adr/0109-ai-tool-authoring-model.md) the default path declares **zero** `defineTool` records. The runtime already -materialises one `action_` tool per AI-exposed Action, so a skill names -that tool directly. The Action is the same one your UI button runs, so +materialises one tool per AI-exposed Action, so a skill names that tool +directly. The Action is the same one your UI button runs, so permissions, validation and audit are identical whether a human clicks or the assistant calls: @@ -227,11 +227,20 @@ export const LeadQualificationSkill = defineSkill({ surface: 'ask', instructions: `Score the lead with BANT from what you read, then convert it when the user agrees. Scoring is your judgement — there is no scoring tool.`, - tools: ['get_record', 'query_records', 'action_convert_lead'], + tools: ['get_record', 'query_records', 'action_crm_lead__convert_lead'], }); ``` -Three things decide whether `action_` exists, and `os validate` checks +An object-bound Action's tool is `action___` (the object +name, two underscores, the action name), and a top-level Action's, bound to no +object, is `action_`. A qualified name longer than 64 characters is +shortened to its head plus a hash, so take the exact spelling from +`actionToolName` in `@objectstack/spec/ai` rather than writing a long one by +hand. The older `action_` spelling of an object-bound Action still +resolves, but to every exposed Action of that name, whatever its object. +`action_*` keeps its meaning: every exposed Action. + +Three things decide whether an Action's tool exists, and `os validate` checks all three (`ai-skill-tool-unresolved`): | Requirement | Why | @@ -268,9 +277,10 @@ itself (a different LLM-facing description, fewer exposed parameters). when the server it is installed on lists every tool the skill binds, read from that server's own tool list when the prompt request is answered. A plain name is served by a tool of that name, a trailing wildcard (`describe_*`) by any listed -tool it matches, and an `action_` entry (or `action_*`) also by -`run_action`. A skill that binds no tool is offered as before, and `prompts/get` -answers a withheld skill as it answers an unknown prompt name. This holds on the +tool it matches, and any entry that starts with `action_` (`action_*` +included) also by `run_action`. A skill that binds no tool is offered as +before, and `prompts/get` answers a withheld skill as it answers an unknown +prompt name. This holds on the HTTP endpoint and on any host that drives its own MCP server and calls `registerSkillPrompts`, stdio included; the plugin's own long-lived stdio server, which projects skills through `MCPServerRuntime.bridgePrompts` instead, @@ -335,7 +345,7 @@ own `ask` / `build` records use exactly these fields): | `instructions` | System prompt / prime directives | | `model` | Model config: `model` (the model name, optional — absent means the deployment's default model), `temperature`, `maxTokens`, `topP`. There is no `provider`: it was **removed in protocol 19 (#37712)** because no runtime read it — the deployment's AI settings choose the provider, and resolve the model name among the providers they turn on | | `skills` | Skill names to attach (the primary Agent → Skill → Tool capability model) | -| `tools` | **Removed in protocol 17 (#3894)** — the key is not on the type, so a `defineAgent({ … })` literal that sets it fails `tsc` as an excess property, and the strict schema refuses it at parse as an unknown key, naming the [upgrade guide](https://objectstack.ai/docs/protocol-upgrade). This is **not** a rename: there is no key the value moves to. Declare each tool on a **skill** instead — a platform tool by its registered name, or `action_` for one of your own AI-exposed Actions — and attach that skill through `skills` (ADR-0064) | +| `tools` | **Removed in protocol 17 (#3894)** — the key is not on the type, so a `defineAgent({ … })` literal that sets it fails `tsc` as an excess property, and the strict schema refuses it at parse as an unknown key, naming the [upgrade guide](https://objectstack.ai/docs/protocol-upgrade). This is **not** a rename: there is no key the value moves to. Declare each tool on a **skill** instead — a platform tool by its registered name, or `action___` (`action_` when top-level) for one of your own AI-exposed Actions — and attach that skill through `skills` (ADR-0064) | | `knowledge` | **Removed in protocol 17 (#3896)** — the key is not on the type, so a `defineAgent({ … })` literal that sets it fails `tsc` as an excess property, and the strict schema refuses it at parse as an unknown key, naming the [upgrade guide](https://objectstack.ai/docs/protocol-upgrade). Declaring `sources` / `indexes` here never scoped retrieval: `search_knowledge` takes `sourceIds` from the LLM's own tool-call arguments, not from the agent record, so an author who “scoped” access here scoped nothing. This is **not** a rename: there is no key the value moves to — delete the block. Restrict retrieval at the knowledge-service / source level (per-source permissions), and describe intended grounding in `instructions` so the model asks for the right sources | There is no `type` field and no fixed agent "type" taxonomy — behaviour comes from @@ -398,7 +408,7 @@ Always be professional and data-driven.`, }, // Capability comes from skills — the only tool-bearing slot (ADR-0064). - // Each skill names the platform tools and `action_` tools it needs. + // Each skill names the platform tools and `action___` tools it needs. // (There is no agent-level `knowledge` block — it was removed in protocol // 17 (#3896 close-out): declaring sources never scoped retrieval. Restrict // access at the knowledge-service/source level; describe intended @@ -464,9 +474,9 @@ Use reputable data sources.`, maxTokens: 1000, }, - // The enrichment Flows are exposed with `ai.exposed`, so the runtime - // materialises `action_lookup_company` / `action_enrich_contact` for the - // skill to name. + // The enrichment Flow actions on `crm_lead` are exposed with `ai.exposed`, + // so the runtime materialises `action_crm_lead__lookup_company` / + // `action_crm_lead__enrich_contact` for the skill to name. skills: ['contact_enrichment'], }); ``` diff --git a/content/docs/ai/connect-mcp.mdx b/content/docs/ai/connect-mcp.mdx index 14a08552822..d4a9de553cc 100644 --- a/content/docs/ai/connect-mcp.mdx +++ b/content/docs/ai/connect-mcp.mdx @@ -637,7 +637,7 @@ export const CaseTriageSkill = defineSkill({ instructions: `Read the case, classify severity from the account tier and the symptom, then propose the next action. Never close a case the customer has not confirmed.`, - tools: ['query_records', 'action_resolve_case'], + tools: ['query_records', 'action_support_case__resolve_case'], }); ``` @@ -657,15 +657,25 @@ empty list until then. the model to call the tools it binds, so `prompts/list` and `prompts/get` offer a skill only when the connection's own tool list carries every entry of its `tools`: a plain name by a tool of that name, a trailing wildcard (`describe_*`) -by any listed tool it matches, and an `action_` entry (or `action_*`) also -by `run_action`. `case_triage` above is offered on a connection that lists -`query_records` and `run_action`. A token without the `actions:execute` scope +by any listed tool it matches, and any entry that starts with `action_` +(`action_*` included) also by `run_action`. `case_triage` above is offered on a +connection that lists `query_records` and `run_action`. A token without the `actions:execute` scope lists no `run_action`, so it is not offered `case_triage`, and `prompts/get` answers it as it answers an unknown prompt name. A skill that binds no tool is offered as before. When a prompt you expect is missing, connect with a grant that registers the skill's tools, or bind the skill only to tools its intended connections serve. +An action entry names the tool the in-product runtime materialises. An +object-bound Action's tool is `action___` (the object name, two +underscores, the action name), and a top-level Action's, bound to no +object, is `action_`. A qualified name longer than 64 characters is +shortened to its head plus a hash, so take the exact spelling from +`actionToolName` in `@objectstack/spec/ai` rather than writing a long one by +hand. The older `action_` spelling of an object-bound Action still +resolves, but to every exposed Action of that name, whatever its object. +`action_*` keeps its meaning: every exposed Action. + **A skill written for the in-product agents opts out.** The binding answers whether a connection *can* run a playbook, not whether the playbook is written for MCP: a skill can bind tools MCP serves under the same names diff --git a/content/docs/ai/tools.mdx b/content/docs/ai/tools.mdx index 7543cef2b0a..3154ac3a56d 100644 --- a/content/docs/ai/tools.mdx +++ b/content/docs/ai/tools.mdx @@ -34,7 +34,7 @@ differs is where that name comes from: | What you want the agent to do | How you get there | Tool record? | |:---|:---|:---| | Read, query, aggregate, or search — what the platform already does for every app | Name the **platform tool** in your skill: `query_records`, `get_record`, `aggregate_data`, `search_knowledge`, `describe_object`, … | **No** | -| Run something your app already does — a `script` / `api` / `flow` Action | Opt the Action in with `ai.exposed` + `ai.description`; the runtime materialises one `action_` tool per exposed Action and your skill names that. See [Actions as Tools](/docs/ai/actions-as-tools). | **No** | +| Run something your app already does — a `script` / `api` / `flow` Action | Opt the Action in with `ai.exposed` + `ai.description`; the runtime materialises one `action___` tool per exposed Action (`action_` for a top-level one) and your skill names that. See [Actions as Tools](/docs/ai/actions-as-tools). | **No** | | Reach a system outside your app | Connect it over MCP — see [Connect an MCP Client](/docs/ai/connect-mcp) | **No** | | Present an executable to the model *differently* from the way your app runs it | A `tool` record — the optional refinement layer described below | **Yes**, and rarely | @@ -73,12 +73,21 @@ export const CaseTriageSkill = defineSkill({ label: 'Case Triage', surface: 'ask', instructions: 'Read the case and its recent activity, then escalate when the customer is blocked.', - tools: ['get_record', 'query_records', 'action_escalate_case'], + tools: ['get_record', 'query_records', 'action_support_case__escalate_case'], }); ``` +**The tool's name.** An object-bound Action's tool is +`action___` (the object name, two underscores, the action +name), and a top-level Action's, bound to no object, is `action_`. A qualified name longer than 64 characters is +shortened to its head plus a hash, so take the exact spelling from +`actionToolName` in `@objectstack/spec/ai` rather than writing a long one by +hand. The older `action_` spelling of an object-bound Action still +resolves, but to every exposed Action of that name, whatever its object. +`action_*` keeps its meaning: every exposed Action. + The full walkthrough — including the three conditions that decide whether -`action_` exists at all — is in +an action's tool exists at all — is in [AI Agents](/docs/ai/agents#a-skill-needs-no-tool-records--name-the-action). ### Why that is the default @@ -184,7 +193,7 @@ export const CaseHandoverSkill = defineSkill({ label: 'Case Handover', surface: 'ask', instructions: 'Summarise before you escalate, and put the summary in the handover note.', - tools: ['summarise_case', 'action_escalate_case', 'get_record'], + tools: ['summarise_case', 'action_support_case__escalate_case', 'get_record'], }); ``` @@ -196,8 +205,10 @@ tools (`MCP_FILE_TOOL_NAMES` in `@objectstack/spec/system`): 1. the stack's own `tools[]` names — the refinement records on this page; 2. the curated registry of tools the platform runtime registers at boot; -3. the materialised `action_` family, one per AI-exposed Action declared - on the stack or on any object. +3. the materialised action family, one tool per AI-exposed Action declared + on the stack or on any object: `action___` when the Action + is object-bound (its older `action_` spelling resolves too), and + `action_` when it is top-level. A trailing wildcard matches every member of that universe sharing the prefix, so `action_*` subscribes a skill to all of the app's exposed Actions at once. @@ -212,7 +223,7 @@ it, never by listing it on the agent. ## See also -- [Actions as Tools](/docs/ai/actions-as-tools) — the default path: an Action materialised as an `action_` tool +- [Actions as Tools](/docs/ai/actions-as-tools) — the default path: an Action materialised as an `action___` tool - [AI Agents](/docs/ai/agents) — the two platform agents, and skills as the extension primitive - [Connect an MCP Client](/docs/ai/connect-mcp) — reaching tools outside your app - [AI Skills System](/docs/ai/skills) — a different layer: the `SKILL.md` knowledge modules that teach a coding assistant to *write* your metadata