Skip to content

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.

Configure these four roles:

CapabilityTypical modulePurpose
OrganizationUnitsdepartments, teamsUnits and their parent hierarchy
OrganizationMembersemployees, usersHumans and standalone agents assigned to units
OrganizationAssignmentsorganization assignmentsReporting lines and executive/lead flags
OrganizationAgentPoliciesorganization agent policiesOptional explicit full or none access overrides

Capabilities add their canonical fields during Bakery planning. Existing fields can be retained through field_mapping.

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.

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.

Apply the module changes through the normal Bakery workflow, then create missing assignment records:

Terminal window
php bakery plan
php bakery apply
php bakery system organization-sync example

The 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.

The runtime applies these rules before creating a chat or background run:

  1. A proxy agent is private to the human it represents.
  2. A human can directly use standalone agents below their own assignment.
  3. A peer, unrelated, or superior agent requires an approved Case or Task whose human approver covers both sides of the relationship.
  4. An executive can use an unassigned standalone agent.
  5. Explicit full and none policies 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.

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.