Organization structure and agent access
Brezel can project an organization chart from existing business modules. Departments, employees, and agents remain normal Brezel entities; capabilities only describe which fields carry organizational meaning.
The hierarchy is used by the organization structure widget and by the agent runtime. It does not require fixed module identifiers such as departments or employees.
Required capabilities
Section titled “Required capabilities”Configure these four roles:
| Capability | Typical module | Purpose |
|---|---|---|
OrganizationUnits | departments, teams | Units and their parent hierarchy |
OrganizationMembers | employees, users | Humans and standalone agents assigned to units |
OrganizationAssignments | organization assignments | Reporting lines and executive/lead flags |
OrganizationAgentPolicies | organization agent policies | Optional explicit full or none access overrides |
Capabilities add their canonical fields during Bakery planning. Existing fields can be retained through field_mapping.
Map existing modules
Section titled “Map existing modules”An existing department module only needs the capability. leaders_field is optional and can point to an existing employee relation:
{ "identifier": "OrganizationUnits", "options": { "leaders_field": "manager" }}For an employee module, map the existing organizational fields:
{ "identifier": "OrganizationMembers", "options": { "unit_module": "departments", "active_values": ["active"], "field_mapping": { "name_field": "first_name", "unit_field": "department", "active_field": "status", "type_field": "actor_type" } }}actor_type=ai represents a standalone agent position. A proxy agent remains attached to its human owner and therefore inherits that person’s position.
Add assignments and policies
Section titled “Add assignments and policies”Assignments use a neutral (member_module, member_entity_id) reference, so one hierarchy can include members from different modules:
{ "identifier": "organization_assignments", "options": { "capabilities": [ {"identifier": "OrganizationAssignments"} ] }, "fields": []}Policies are optional:
{ "identifier": "organization_agent_policies", "options": { "capabilities": [ { "identifier": "OrganizationAgentPolicies", "options": { "assignments_module": "organization_assignments" } } ] }, "fields": []}An access policy relates a requester assignment to a target assignment. full grants direct access and none denies it. inherit uses the reporting hierarchy.
is_executive=true explicitly marks an assignment as a member of executive management. A missing reports_to value only means that the member reports directly to executive management; it does not grant executive status. The organization editor exposes separate drop targets for both operations.
Build and synchronize
Section titled “Build and synchronize”Apply the module changes through the normal Bakery workflow, then create missing assignment records:
php bakery planphp bakery applyphp bakery system organization-sync exampleThe sync command is idempotent. It creates missing assignments and, when unit leaders are configured, infers empty reporting lines from the unit manager. New organization members are assigned automatically after entity creation.
Agent access rules
Section titled “Agent access rules”The runtime applies these rules before creating a chat or background run:
- A proxy agent is private to the human it represents.
- A human can directly use standalone agents below their own assignment.
- A peer, unrelated, or superior agent requires an approved Case or Task whose human approver covers both sides of the relationship.
- An executive can use an unassigned standalone agent.
- Explicit
fullandnonepolicies override inherited standalone-agent access.
The decision is stored in the run’s work-context snapshot as organization_access. Systems without OrganizationAssignments retain the previous agent behavior.
Case UIs can query CaseAgentTriggers with the approval-access capability action before presenting an approval action. The result states whether the current user may approve the Case and, for hierarchy restrictions, lists the nearest human assignments that cover both the approving user and every target agent. Approval is checked again before review_state=approved is persisted. A rejected request returns HTTP 403 with code organization_superior_approval_required and the same organization-access payload, so clients can explain who must approve the Case instead.
Inactive organization assignments do not participate in the hierarchy. Their members are resolved as unassigned; unless an explicit policy applies, only an executive human can approve work for an unassigned standalone agent.
Organization structure UI
Section titled “Organization structure UI”The native page is available at /{locale}/organization. The same view can be embedded in a layout:
{ "component": "widget", "widget": "organization_structure", "title": "Organization", "refresh_interval": 15}The editor uses normal entity APIs for changes. Users need view permission on the assignments module to open it and update permission to drag members, change reporting lines, or create records. Units can reference another unit through parent_unit; the hierarchy and editor support arbitrary nesting depth and reject cycles. Active agent runs are refreshed periodically; clicking their status opens the associated chat session.
Circular unit or reporting hierarchies are rejected while resolving the graph. Correct the involved parent or reports_to records before running agents again.