This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Note: This is the Umbraco.AI.Agent add-on package. See the root CLAUDE.md for shared coding standards, build commands, and repository-wide conventions that apply to all packages.
# Build the solution
dotnet build Umbraco.AI.Agent.slnx
# Build frontend assets (from Client directory)
cd src/Umbraco.AI.Agent.Web.StaticAssets/Client
npm install
npm run build
# Watch frontend during development
npm run watch# Run all tests
dotnet test Umbraco.AI.Agent.slnx
# Run specific test project
dotnet test tests/Umbraco.AI.Agent.Tests.Unit/Umbraco.AI.Agent.Tests.Unit.csprojUmbraco.AI.Agent is an agent management plugin for Umbraco.AI. It provides storage, organization, and management of AI agent definitions with full backoffice UI integration.
| Project | Purpose |
|---|---|
Umbraco.AI.Agent.Core |
Core domain models, services, and repository interfaces |
Umbraco.AI.Agent.Persistence |
EF Core DbContext, entities, and repository implementations |
Umbraco.AI.Agent.Persistence.SqlServer |
SQL Server migrations |
Umbraco.AI.Agent.Persistence.Sqlite |
SQLite migrations |
Umbraco.AI.Agent.Web |
Management API controllers, models, and mapping |
Umbraco.AI.Agent.Web.StaticAssets |
TypeScript/Lit frontend components |
Umbraco.AI.Agent.Startup |
Umbraco Composer for auto-discovery and DI registration |
Umbraco.AI.Agent |
Meta-package that bundles all components |
IAIAgentService- Primary interface for agent CRUD operations and tool permission validationGetAllowedToolIdsAsync(agent)- Returns all tool IDs allowed for an agent (both direct and scope-based)IsToolEnabledAsync(agent, toolId)- Checks if a specific tool is allowed for an agent
IAIAgentRepository- Repository interface for agent persistence
The AIAgent entity represents a stored agent definition:
Id- Unique identifierAlias- URL-safe unique identifierName- Display nameDescription- Optional descriptionContent- The agent definition textProfileId- Optional link to Umbraco.AI profile (soft FK)Tags- Categorization tagsIsActive- Active statusAllowedToolIds- List of specific tool IDs allowed for this agentAllowedToolScopeIds- List of tool scope IDs allowed for this agent (grants access to all tools in those scopes)DateCreated/DateModified- Timestamps
Agents can have fine-grained control over which tools they can access through two mechanisms:
1. Direct Tool Access (AllowedToolIds)
- Explicitly grant access to specific tools by their ID
- Example:
["umbraco-content-get", "umbraco-media-upload"]
2. Scope-Based Access (AllowedToolScopeIds)
- Grant access to all tools within a scope
- Scopes represent categories of operations (e.g., "content-read", "media-write")
- Example:
["content-read", "search"]grants access to all tools in those scopes
Permission Resolution:
- A tool is enabled if it appears in
AllowedToolIdsOR if its scope appears inAllowedToolScopeIds - Case-insensitive comparison for both tool IDs and scope IDs
- Permission checks are performed via
IAIAgentService.IsToolEnabledAsync(agent, toolId)
Usage Example:
// Check if a specific tool is allowed for an agent
bool canUseContentGet = await agentService.IsToolEnabledAsync(agent, "umbraco-content-get");
// Get all enabled tool IDs for an agent
IReadOnlyList<string> allowedTools = await agentService.GetAllowedToolIdsAsync(agent);Endpoints are under /umbraco/ai/management/api/v1/agents/:
| Method | Endpoint | Description |
|---|---|---|
| GET | /agents |
Get all agents (paged) |
| GET | /agents/{agentIdOrAlias} |
Get agent by ID or alias |
| GET | /agents/profile/{profileId} |
Get agents by profile |
| POST | /agents |
Create agent |
| PUT | /agents/{agentIdOrAlias} |
Update agent by ID or alias |
| DELETE | /agents/{agentIdOrAlias} |
Delete agent by ID or alias |
The {agentIdOrAlias} parameter accepts either a GUID (e.g., 550e8400-e29b-41d4-a716-446655440000) or a string alias (e.g., my-agent-alias). This pattern matches Umbraco.AI's IdOrAlias convention.
The API shares the same Swagger group (ai-management) as Umbraco.AI.
Migrations use the UmbracoAIAgent_ prefix.
# SQL Server
dotnet ef migrations add UmbracoAIAgent_<MigrationName> \
-p src/Umbraco.AI.Agent.Persistence.SqlServer \
-c UmbracoAIAgentDbContext \
--output-dir Migrations
# SQLite
dotnet ef migrations add UmbracoAIAgent_<MigrationName> \
-p src/Umbraco.AI.Agent.Persistence.Sqlite \
-c UmbracoAIAgentDbContext \
--output-dir Migrations- Feature folders are flat - All files for a feature live at the folder root
- Interfaces and implementations live side-by-side
- Shared code lives at the project root level (Models/, Configuration/)
Web follows Umbraco CMS Management API conventions:
Controllers/- API endpointsModels/- Request/response DTOsMapping/- UmbracoMapper definitions
Umbraco.AI.Agent.Core.Agents- Agent domain model and servicesUmbraco.AI.Agent.Persistence- EF Core persistenceUmbraco.AI.Agent.Web.Api.Management.Agent- API controllers and modelsUmbraco.AI.Agent.Extensions- DI extension methods
{
"Umbraco": {
"AI": {
"Agent": {
// Future configuration options
}
}
}
}- .NET 10.0 (
net10.0) - Uses Central Package Management (
Directory.Packages.props) - Nullable reference types enabled
- Umbraco CMS 17.x
- Umbraco.AI 1.x
- Entity Framework Core 10.x