> ## Documentation Index
> Fetch the complete documentation index at: https://docs.seekr.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Work with teams

> Scope SDK requests to a team so resources are created in and read from the right place.

Every resource in SeekrFlow (agents, fine-tuning jobs, deployments, files, and vector databases) belongs to a team. SDK requests are scoped to a single team. Resources you create are owned by that team, and list and retrieve calls return only that team's resources. For the underlying access model, see [Role-based access control](/flow/role-based-access-control).

<Note>
  Threads, and the messages and runs in them, are always user-owned, so selecting a team doesn't affect them. Agents are team-owned, but the threads you run them on are not.
</Note>

## Set the active team

Setting a team is optional. If you don't, requests use your **personal workspace**, the private, single-member team that every user has by default.

The [Teams Settings page](/flow/app/manage-permissions#find-a-team-id) in the SeekrFlow web interface lists every team you belong to and its ID. Resources returned by the SDK also include the `team_id` of their owning team.

The SDK sends the team you select as the `x-team-id` request header. You can set it in two ways.

**Environment variable (recommended).** Set `SEEKR_TEAM_ID` and the SDK applies it automatically to every request:

<CodeGroup>
  ```bash Linux / macOS theme={null}
  export SEEKR_TEAM_ID=124cb1bb-d8d3-4e9b-9c96-2039fba43e78
  ```

  ```bash Windows theme={null}
  set SEEKR_TEAM_ID=124cb1bb-d8d3-4e9b-9c96-2039fba43e78
  ```
</CodeGroup>

```python Python theme={null}
import os
from seekrai import SeekrFlow

# Picks up SEEKR_API_KEY and SEEKR_TEAM_ID from the environment.
client = SeekrFlow()
```

**Per-client header.** Set `supplied_headers` when you construct the client. This takes precedence over `SEEKR_TEAM_ID`, which is useful when one process works across several teams:

```python Python theme={null}
import os
from seekrai import SeekrFlow

client = SeekrFlow(
    api_key=os.environ.get("SEEKR_API_KEY"),
    supplied_headers={"x-team-id": "124cb1bb-d8d3-4e9b-9c96-2039fba43e78"},
)
```

Both approaches work the same way on the asynchronous client:

```python Python theme={null}
from seekrai import AsyncSeekrFlow

client = AsyncSeekrFlow(supplied_headers={"x-team-id": "124cb1bb-d8d3-4e9b-9c96-2039fba43e78"})
```

<Note>
  The team applies to the whole client. Every call made through a client is scoped to that client's team. To act on more than one team in the same process, create a separate client per team.
</Note>

## Create resources in a team

Once a client is scoped to a team, every resource you create through it belongs to that team. No extra argument is needed on individual calls:

```python Python theme={null}
from seekrai import SeekrFlow

client = SeekrFlow(supplied_headers={"x-team-id": "124cb1bb-d8d3-4e9b-9c96-2039fba43e78"})

# Owned by the client's team.
uploaded = client.files.upload(file="training_data.jsonl", purpose="fine-tune")
```

## Read resources from a team

List and retrieve calls return only the resources owned by the client's team. Requests for a resource that belongs to a team you aren't a member of are rejected.

```python Python theme={null}
from seekrai import SeekrFlow

client = SeekrFlow(supplied_headers={"x-team-id": "124cb1bb-d8d3-4e9b-9c96-2039fba43e78"})

# Only files owned by the client's team.
for f in client.files.list().data:
    print(f.id, f.filename)
```

Returned resources carry the `team_id` of their owning team alongside the `user_id` of the creator, so you can confirm where a resource lives:

```python Python theme={null}
agent = client.agents.retrieve(agent_id)
print(agent.team_id)  # e.g. "124cb1bb-d8d3-4e9b-9c96-2039fba43e78"
print(agent.user_id)  # the user who created it
```

## Work across multiple teams

To operate on several teams in one program, create one client per team:

```python Python theme={null}
from seekrai import SeekrFlow

research = SeekrFlow(supplied_headers={"x-team-id": "124cb1bb-d8d3-4e9b-9c96-2039fba43e78"})
production = SeekrFlow(supplied_headers={"x-team-id": "7d9f2a10-4c6b-4f23-8a1e-5b0c9d3e4f21"})

research_files = research.files.list().data
production_files = production.files.list().data
```

A resource created in one team is not visible to another. To use a resource across teams, recreate it in each team.
