---
id: object/codeunit/4350
type: object
title: Codeunit 4350 "Custom Agent Setup"
summary: Codeunit 4350 "Custom Agent Setup" in AgentDesignExperience (System.Agents.Designer.CustomAgent). 13 public procedures, 2 event subscribers. Introduced in BC29, still in BC30.
tier: official
language: en
tags:
  - codeunit
  - agentdesignexperience
versions:
  introduced: "29"
  last_changed: null
  deprecated: null
review:
  state: derived
  by: null
  at: null
  flags: []
generated:
  at: "2026-10-11T00:31:51.816Z"
  pipeline: 0.2.0
  prompts: {}
  input_hash: c347a05beb7d79bd1c5bda27703d49f6332173186e61d408f5c5e57a01f1e800
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/Apps/W1/AgentDesignExperience/app/CustomAgent/Setup/CustomAgentSetup.Codeunit.al
    title: src/Apps/W1/AgentDesignExperience/app/CustomAgent/Setup/CustomAgentSetup.Codeunit.al (releases/29.x)
    date: null
    commit: ea08af5ef2d6a9b5c5af4a029288abbe2c883220
    t: null
    quote: null
links:
  learn: []
  objects: []
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
  changes:
    - change/bcapps/10631
    - change/bcapps/10386
object_type: codeunit
object_id: 4350
name: Custom Agent Setup
namespace: System.Agents.Designer.CustomAgent
app: AgentDesignExperience
extends: null
first_version: "29"
last_version: "30"
present_in:
  - "29"
  - "30"
changed_in: []
source_major: "29"
obsolete: null
countries: []
ms_search_form_ids: []
counts:
  fields: 0
  procedures: 19
  events: 0
  subscribers: 2
relations:
  out: 0
  referenced_by: 0
  pages: 0
  extended_by: 0
  event_subscribers: 0
  calls: 6
  called_by: 5
  implements: 0
---

# Codeunit 4350 "Custom Agent Setup"

> Codeunit 4350 "Custom Agent Setup" in AgentDesignExperience (System.Agents.Designer.CustomAgent). 13 public procedures, 2 event subscribers. Introduced in BC29, still in BC30.

AgentDesignExperience · System.Agents.Designer.CustomAgent · BC29-30 · [source at ea08af5e](https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/Apps/W1/AgentDesignExperience/app/CustomAgent/Setup/CustomAgentSetup.Codeunit.al) · facts from BC29

## Properties

| Property | Value |
|---|---|
| Access | Internal |

## Event subscriptions

- OnRegisterCopilotCapability subscribes to Page "Copilot AI Capabilities" OnRegisterCopilotCapability
- CleanupCustomAgentSetup subscribes to Table "Agent" OnAfterDeleteEvent

## Procedures

- `GetDefaultInitials(): Text[4]`
- `GetAgentType(): Text`
- `GetAccessControl(AgentUserSecurityID: Guid; var TempAccessControlBuffer: Record "Access Control Buffer" temporary)`
- `GetDefaultProfile(var TempAllProfile: Record "All Profile" temporary)`
- `UpdateAgent(var AgentSetupBuffer: Record "Agent Setup Buffer"; var TempAccessControlBuffer: Record "Access Control Buffer" temporary)`
- `UpdateAccessControl(AgentUserSecurityId: Guid; var TempAccessControlBuffer: Record "Access Control Buffer" temporary)`
- `CreateAgent(var TempAgent: Record Agent; var TempAgentAccessControl: Record "Agent Access Control" temporary; var TempAccessControlBuffer: Record "Access Control Buffer" temporary)`
- `CreateAgent(AgentUserName: Code[50]; AgentDisplayName: Text[80]; var TempAgentAccessControl: Record "Agent Access Control" temporary; var TempAccessControlBuffer: Record "Access Control Buffer" temporary; Initials: Text[4]): Guid`
- `CreateAgent(AgentUserName: Code[50]; AgentDisplayName: Text[80]; var TempAgentAccessControl: Record "Agent Access Control" temporary; var TempAccessControlBuffer: Record "Access Control Buffer" temporary; Initials: Text[4]; Description: Text[250]; Instructions: Text): Guid`
- `CreateCustomAgentSetup(AgentUserSecurityID: Guid; Initials: Text[4]; Description: Text[250]; Instructions: Text)`
- `OpenEditInstructionsPage(AgentSecurityId: Guid)`
- `GenerateInitialsFromName(AgentName: Text[50]): Code[4]`
- `RegisterCapability()`

Plus 4 local procedures.

## Calls

From the extracted call graph of BC29 (graphify-al on the snapshot checkout): calls whose target is known from a declared type or an `Object::"Name"` argument. Interface dispatch and calls through events are not counted, so the list is not complete.

- [Codeunit 4321 "Agent"](../codeunit/4321.md) (4 calls: `CreateAgent → Activate`, `CreateAgent → Deactivate`, `GetDefaultProfile → PopulateDefaultProfile`, …)
- [Codeunit 7773 "Copilot Capability"](../codeunit/7773.md) (2 calls: `RegisterCapability → IsCapabilityRegistered`, `RegisterCapability → RegisterCapability`)
- [Codeunit 4324 "Agent Setup"](../codeunit/4324.md) (1 call: `UpdateAgent → SaveChanges`)
- [Codeunit 4358 "Custom Agent Metadata Provider"](../codeunit/4358.md) (1 call: `GetDefaultInitials → GetDefaultInitials`)
- [Codeunit 4362 "Agent Designer Permissions"](../codeunit/4362.md) (1 call: `CreateAgent → VerifyCurrentUserCanCreateCustomAgents`)
- [Codeunit 457 "Environment Information"](../codeunit/457.md) (1 call: `RegisterCapability → IsSaaSInfrastructure`)

## Called by

- [Page 4350 "Custom Agent Setup"](../page/4350.md) (5 calls: `IsAgentConfiguredCheck → GetDefaultProfile`, `OnQueryClosePage → OpenEditInstructionsPage`, `OnQueryClosePage → UpdateAgent`, …)
- [Codeunit 4356 "Custom Agent Import"](../codeunit/4356.md) (3 calls: `CreateAgent → CreateAgent`, `ReplaceExistingAgent → CreateCustomAgentSetup`, `ReplaceExistingAgent → UpdateAccessControl`)
- [Codeunit 4358 "Custom Agent Metadata Provider"](../codeunit/4358.md) (2 calls: `GetDefaultProfile → GetDefaultProfile`, `GetInitials → GetDefaultInitials`)
- [Codeunit 4354 "Agent Designer Install"](../codeunit/4354.md) (1 call: `OnInstallAppPerDatabase → RegisterCapability`)
- [Page 4351 "Custom Agents Wizard"](../page/4351.md) (1 call: `NextStep → (object)`)

## Recent changes

- 2026-08-26 [#10631 Integration/main to releases 29.x 31a860b5](../../changes/bcapps/10631.md) (releases/29.x, BC29, feature)
- 2026-08-21 [#10386 [Agent Archiving] Prevent archived custom agents from being modified](../../changes/bcapps/10386.md) (main, BC30, feature)

## Across versions

- Present in: BC29-30
- Changed (declaration) in: none

Source: AL metadata extracted from the code (names, ids, signatures, properties); no code bodies (D10).

## Ask your agent

Procedure bodies are not stored here (D10). The call sections above are our own, per object, from the BC29 call graph. For a procedure body or the calls of one procedure, ask bc-code-atlas (external, by Stefan Maron, MIT; default corpus w1-28), which the bc-observatory plugin connects: `bcatlas_resolve_node(object_type: "codeunit", object_name: "Custom Agent Setup")`, then `bcatlas_get_procedure_body` or `bcatlas_get_neighbors` on the returned id.
