Skip to content

AI tools: approval inside agents, a kind on each tool, and aliases for renamed tools #326

Done

Description

@JackTelford

What is missing today

  1. Approval stops at the agent boundary. A tool registered with .RequireApproval() asks the user in an AG-UI chat run when it is on the assistant's own profile. Inside an agent (a profile of type Agent with AllowToolInvocation) the same tool runs without asking. AgentProxyTool.RunWithToolsAsync builds a new orchestration context for the agent and reads only text from its stream, AICompletionContextKeys.ToolApprovalSupported is set only for the top-level turn, and DefaultToolMaterializer wraps a tool for approval only when it is set.
  2. A registration does not say what a tool does. AIToolDefinitionEntry knows RequiresApproval and nothing else, so a host cannot tell from data which tools read, write, delete, send something outside the application or change access. ExposeAllTools of the MCP server and of WebMCP hands out every selectable tool, the deleting ones included.
  3. A tool cannot be renamed. Tool names are stored on profiles, templates and chat interactions, in the Tools lists of the MCP server and WebMCP settings, and in what hosts derive from them (a permission for each tool). After a rename a stored name finds no tool.

Why it matters

A site assistant with several hundred tools has to group them into agents, because one profile cannot carry them (the orchestrator trims a tool list above 30 entries). Today that grouping removes every approval: a tool that deletes runs unasked as soon as it sits inside an agent. This came out of the AI tool coverage plan for CrestApps.OrchardCore (CrestApps/CrestApps.OrchardCore#1334), which lists it as the framework work that has to land before tools are grouped into agents.

What the change does

  • Approval inside agents. The agent's run inherits whether its caller can ask. A tool call that needs approval pauses the agent, the assistant's run ends with an interrupt that names the agent, the tool and its arguments, approve continues the agent where it stopped, and reject gives the agent a refusal it can report. Nothing the agent did before the pause is done again. When nobody can be asked, the tool does not run inside an agent and the agent is told why.
  • Kind. Read, Write, Destructive, External, Security on the registration. Destructive, External and Security imply approval; .RequireApproval() stays for exceptions. ExposeAllTools leaves Destructive and Security tools out unless they are named.
  • Aliases. .WithAlias("oldName"). A stored old name resolves to the tool wherever names are resolved; listings show the tool once.

Existing registrations and stored data keep working.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions