# Add a team

URL: /agents/add-a-team · Id: `guide:add-a-team`

> Create a Team for work no department owns, then open its lead seat and put an agent in it, in three calls.

A [Team](/business/nouns/team) groups the [Roles](/business/nouns/role) that do one kind of work under one owner. Add one when no department owns the work; for one more seat on a Team, [add a role](/agents/add-a-role).

**Before it runs**

- You leave the chat: Never: it all happens in the chat.

## What you get
- 1 team on the org chart, with its mission written down (Team)
- 1 lead seat on that team, with its duties (Role)
- 1 agent in the lead seat (Agent)

## Your agent does
**For agents**

- Guide: `guide:add-a-team`, status `live`. Page: [/agents/add-a-team.md](/agents/add-a-team.md).
- Approval: none. Run it when the founder asks.
- Leaves the chat: never.
- Run: call the steps in order, each through the API, SDK, CLI or MCP tab below; a later step passes the `$id` an earlier one returns. Each value marked example is the sample business’s: pass the founder’s own.

| Step | Verb | Inputs (type, required, this guide’s value) | Returns |
| --- | --- | --- | --- |
| 1 | [`Team.create`](/business/nouns/team/create) (`verb:Team.create`) | `mission` text, required: example `"Inspects every managed unit once a year and books the repairs it finds."` | `team` Team |
| 2 | [`Role.create`](/business/nouns/role/create) (`verb:Role.create`) | `name` string, required: example `"Field Lead"`; `responsibilities` text: example `"Schedules each unit’s yearly inspection and files the repairs it finds."`; `team` Team (an id): the `$id` step 1 returns | `role` Role |
| 3 | [`Role.staff`](/business/nouns/role/staff) (`verb:Role.staff`) | `role` Role (an id), required: the `$id` step 2 returns; `worker` Worker (an id), required: example `"agent_field_lead"` | `role` Role |

Returns: the last call answers with `role` and its `action`, whose `status` is `done`, `pending` (waiting on an Approval or a Worker), `failed`, `canceled` or `refused`:

```json
{
  "api": "https://api.sb/leaseline.app",
  "role": {
    "$id": "https://api.sb/leaseline.app/roles/role_1",
    "$type": "Role",
    "name": "Field Lead",
    "responsibilities": "Schedules each unit’s yearly inspection and files the repairs it finds.",
    "status": "filled"
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/action_1",
    "operation": "Role.staff",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/action_1"
  }
}
```

Next: offer “Put the Maintenance Coordinator on it too”, or “Have the Operations Lead approve its spend”.

Calls: `Team.create` → `Role.create` → `Role.staff`

Ask:

```text
Add a team.
Start a field team for property inspections.
Create a new department.
```

API:

```bash
# 1. Team.create
TEAM=$(curl -X POST https://api.sb/leaseline.app/teams \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"mission":"Inspects every managed unit once a year and books the repairs it finds."}' | jq -r '.team["$id"] | split("/") | last')

# 2. Role.create
ROLE=$(curl -X POST https://api.sb/leaseline.app/roles \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"Field Lead","responsibilities":"Schedules each unit’s yearly inspection and files the repairs it finds.","team":"'"$TEAM"'"}' | jq -r '.role["$id"] | split("/") | last')

# 3. Role.staff
curl -X POST https://api.sb/leaseline.app/roles/$ROLE/staff \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"worker":"agent_field_lead"}'
```

SDK:

```ts
import { $ } from 'startup-builder'

const team = await $.Team.create({ mission: 'Inspects every managed unit once a year and books the repairs it finds.' })
const role = await $.Role.create({ name: 'Field Lead', responsibilities: 'Schedules each unit’s yearly inspection and files the repairs it finds.', team: team.$id })
await $.Role.staff({ role: role.$id, worker: 'agent_field_lead' })
```

CLI:

```bash
TEAM=$(npx startup-builder do Team.create --json '{"mission":"Inspects every managed unit once a year and books the repairs it finds."}' | jq -r '.team["$id"] | split("/") | last')
ROLE=$(npx startup-builder do Role.create --json '{"name":"Field Lead","responsibilities":"Schedules each unit’s yearly inspection and files the repairs it finds.","team":"'"$TEAM"'"}' | jq -r '.role["$id"] | split("/") | last')
npx startup-builder do Role.staff --json '{"role":"'"$ROLE"'","worker":"agent_field_lead"}'
```

MCP:

```json
{
  "name": "do",
  "arguments": {
    "code": "const team = await $.Team.create({ mission: 'Inspects every managed unit once a year and books the repairs it finds.' })\nconst role = await $.Role.create({ name: 'Field Lead', responsibilities: 'Schedules each unit’s yearly inspection and files the repairs it finds.', team: team.$id })\nreturn await $.Role.staff({ role: role.$id, worker: 'agent_field_lead' })"
  }
}
```

## Change it
- Put the Maintenance Coordinator on it too.
- Have the Operations Lead approve its spend.
- Keep it asleep until we pass 500 units.

## Under the hood
- Systems: [Workforce](/systems/workforce)
- Nouns: [Team](/business/nouns/team), [Role](/business/nouns/role), [Agent](/business/nouns/agent)
- Events: `Team.created`, [`Role.staffed`](/business/events/Role.staffed)

A Team is asleep until one of its [Processes](/business/nouns/process) is on. [Teams](/agents/teams) shows the eleven every [Startup](/business/nouns/startup) inherits and which are awake at each state.