Departments
Departments are an organizational grouping on the agent record and the work-item API. They are managed through the REST API — there is no department management screen in the dashboard.
What is a department?
A department is a grouping of agents within your organization — for example "Customer Support," "Engineering," or "Finance." Each agent carries an optional department_id, every work item is created against a department, and department-level cost roll-ups are available through the API.
Where departments appear
- Agent record — an agent's department is the one its work items are filed under when you use Dispatch Work on the agent detail page.
- Work items —
department_idis required when creating a work item through the REST API or thecompany__create_work_itemgateway tool. - Costs —
GET /hub/ai-company/departments/{dept_id}/costsreturns spend for the department's agents. - Agent gateway — agents can read their department's goals with
company__read_department_goals.
REST API
All endpoints are under the hub API and require your Supabase session JWT plus an org_id query parameter.
| Endpoint | What it does |
|---|---|
| GET /hub/ai-company/departments | List departments in the org. |
| POST /hub/ai-company/departments | Create a department (name required; optional description, mission and autonomy_level). |
| GET /hub/ai-company/departments/{dept_id} | Read one department. |
| PATCH /hub/ai-company/departments/{dept_id} | Update a department. |
| GET /hub/ai-company/departments/memberships | List which members belong to which department. |
| GET /hub/ai-company/departments/{dept_id}/costs | Cost roll-up for the department's agents. |
Budget and risk threshold
The department record carries a budget (budget_credits against budget_spent) and a risk_threshold (0–100). Both are checked when a work item is created: a department whose budget is exhausted refuses new work items (HTTP 402), and a work item whose risk_score exceeds the department's threshold is created in pending_approval instead of the backlog. Per-agent spend caps are separate — see Monitoring & Costs.