Metadata-Version: 2.4
Name: orbee
Version: 0.3.0
Summary: Understand your Google Cloud platform, across projects: what changed, what broke, who has access. Read-only.
Keywords: google-cloud,gcp,platform-engineering,sre,audit-logs,iam,cloud-asset-inventory,observability,mcp,cli
License-Expression: Apache-2.0
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: System Administrators
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: System :: Monitoring
Classifier: Topic :: System :: Systems Administration
Requires-Dist: google-cloud-asset>=3.26
Requires-Dist: google-cloud-audit-log>=0.3
Requires-Dist: google-cloud-bigquery>=3.27
Requires-Dist: google-cloud-logging>=3.11
Requires-Dist: google-cloud-resource-manager>=1.14
Requires-Dist: mcp>=1.20
Requires-Dist: pydantic-settings>=2.6
Requires-Dist: rich>=13.9
Requires-Dist: typer>=0.15
Requires-Python: >=3.12
Project-URL: Repository, https://github.com/tosun-si/orbee
Project-URL: Changelog, https://github.com/tosun-si/orbee/releases
Project-URL: Issues, https://github.com/tosun-si/orbee/issues
Description-Content-Type: text/markdown

<picture>
  <source media="(prefers-color-scheme: dark)" srcset="docs/assets/orbee-dark.svg">
  <img src="docs/assets/orbee.svg" alt="Orbee: a bee on an orbit" width="120">
</picture>

# Orbee

[![PyPI](https://img.shields.io/pypi/v/orbee)](https://pypi.org/project/orbee/)
[![Python](https://img.shields.io/pypi/pyversions/orbee)](https://pypi.org/project/orbee/)
[![CI](https://github.com/tosun-si/orbee/actions/workflows/ci.yml/badge.svg)](https://github.com/tosun-si/orbee/actions/workflows/ci.yml)
[![Docs](https://github.com/tosun-si/orbee/actions/workflows/docs.yml/badge.svg)](https://tosun-si.github.io/orbee/)
[![License](https://img.shields.io/pypi/l/orbee)](LICENSE)

**Understand your Google Cloud platform. Across projects. With context.**

📖 **Documentation: [tosun-si.github.io/orbee](https://tosun-si.github.io/orbee/)**

Orbee answers the questions a platform team asks every morning and during every incident,
across all the projects of an organization at once:

- What changed since yesterday, and who changed it?
- What failed last night on this team's projects?
- What happened to this service: what failed, and which change came right before?
- Who has access to this resource, and through which group or inherited binding?

Orbee is **read-only** and needs **no setup**: it reads the audit logs and the workload logs
Google already keeps in every project, and links every answer to its evidence in the Google
Cloud console.

Ask from a terminal (`orbee`) or from an AI agent: the MCP server and the Claude Code plugin give
Claude, Gemini CLI or any MCP client the same answers, with the same evidence.

> Status: alpha. `orbee brief`, `orbee incident`, `orbee changes`, `orbee failures` (Cloud Run, Cloud Composer, BigQuery),
> `orbee access`, `orbee coverage`, the MCP server and the Claude Code plugin work end to end; see
> [the roadmap](docs/roadmap.md). A demo guide, commands and agent prompts:
> [orbee-demo](https://github.com/tosun-si/orbee-demo).

## Quick start

```bash
uv tool install orbee                           # or pipx install orbee; uvx orbee runs it without installing
gcloud auth application-default login

export ORBEE_PROJECT=my-platform-tools          # the project Orbee's API calls are billed to
export ORBEE_PARENT=organizations/123456789012  # or folders/456, or the organization number

orbee doctor                                    # which permissions you miss, and how to grant them
orbee changes --since 24h
orbee changes --since 7d -p solis-prd -p billing-prd
orbee changes --since 2h -o json                # with a console link to each log entry
orbee changes --since 200d -p solis-dev --method UpdateProject   # who renamed this project?
orbee changes --since 7d --actor alice@ --resource billing       # any case, substring
```

### What changed: Admin Activity audit logs

```
organization / folder ──▶ Resource Manager: every active project, nested folders included
 ├── project A ┐
 ├── project B ├─ Cloud Logging, _Required bucket ──▶ orbee CLI / MCP
 └── project C ┘  (Admin Activity audit logs, kept 400 days by Google)
```

Every deployment, IAM binding and configuration change of the organization, its projects and the
organization or folder itself, with who made it. Read at the source, 50 projects per Cloud Logging
call: an 84-project organization answers in about 10 seconds over 24 hours. Entries that change
nothing (Apigee status heartbeats, Cloud SQL connections, operation polls) are left out: on a real
organization they are most of the log.

A project whose logs cannot be read is listed as unreachable, its changes unknown, and the
command exits with code `3`.

`--method`, `--resource` and `--actor` filter at the source, before `--limit`. Cloud Logging
still scans every entry of the window, one call after the other inside a call: Orbee reads 5
projects per call and long windows in time slices, 32 reads at a time, within the read quota (200
requests per minute per user, retried with a backoff). On an 84-project organization with Apigee,
a rare method over 200 days takes about 25 seconds.

#### Optional: the BigQuery audit source

```bash
orbee changes --source bigquery --since 30d     # or ORBEE_AUDIT_SOURCE=bigquery
```

The [`org-setup`](terraform/modules/org-setup) Terraform module exports the Admin Activity audit
logs of the whole organization to one partitioned BigQuery table through an aggregated log sink.
Use it to keep them beyond 400 days or to query them in SQL; a question is then one
partition-pruned query, bounded by `ORBEE_MAX_BYTES_BILLED`. It holds the entries from its setup
on, not before.

```hcl
module "orbee" {
  source = "git::https://github.com/tosun-si/orbee.git//terraform/modules/org-setup?ref=main"

  project_id        = "my-platform-tools"
  parent_type       = "organization"
  parent_id         = "123456789012"
  reader_members    = ["group:platform-team@example.com"]
  export_audit_logs = true
}
```

Applying it needs `roles/logging.configWriter`, the right to create a custom role and to grant
roles on the organization (or folder), and the rights to create a dataset and grant roles in
`project_id`. The sink creates its table with the first exported entry; set
`ORBEE_AUDIT_DATASET` to the `dataset_id` output when it is not `orbee_audit`.

The module also grants `reader_members` the **Orbee Reader** custom role on the organization (or
folder). Without `export_audit_logs` (the default), that role is all it creates: the access the
default Cloud Logging source needs, see [Permissions](#permissions).

### What failed: Cloud Run, Cloud Composer and BigQuery

```bash
orbee failures --since 12h                        # every active project under ORBEE_PARENT
orbee failures -p solis-dev -p solis-prd --since 24h
orbee failures -p solis-prd -o json               # with a Logs Explorer link to each failure
orbee failures --since 7d --service cloud_run --kind request   # 5xx only
```

Failures are read at the source, in Cloud Logging, project by project: nothing is copied. Orbee
keeps the `ERROR` entries of:

- **Cloud Run services**: 5xx requests grouped per status, container failures (crash, memory
  limit, startup probe) and application errors grouped per error line;
- **Cloud Run jobs**: errors grouped per execution;
- **Cloud Composer**: Airflow task errors grouped per task run (every attempt), broken DAGs and
  scheduler or triggerer errors;
- **BigQuery**: jobs that failed while running or were refused when submitted, grouped per error
  and per principal, from the Data Access audit logs BigQuery writes by default. A job logged in
  both audit formats is counted once.

Access is checked first (testIamPermissions), then projects are read in batches of 50 per Cloud
Logging call: an 84-project organization answers in about 30 seconds over 7 days. When one
noisy service fills `--limit`, its project keeps the most recent entries and is reported as
truncated, and the others are read again without it.

A project Orbee cannot read is listed as unreachable, its failures unknown, and the command
exits with code `3`; when no project can be read, it fails with code `1`.

### Morning brief: what to look at, per team

```bash
orbee brief                                  # last 24 h, the whole organization
orbee brief --owners owners.toml             # per team, and what no team owns
orbee brief --team payments --since 3d -o json
```

What failed (most entries first), what changed (per project and actor) and the **sensitive**
changes: IAM policies, service account keys, custom roles, organization policies, firewall rules,
project deletion. Sensitive changes are grouped per actor, method and resource, people before
service accounts: a Terraform apply that rewrites a policy twenty times is one line.

Teams come from a TOML file ([example](docs/owners.example.toml)): a team owns whole projects, and
workloads inside shared projects. What no team owns is reported as `unassigned`, never dropped.
With `--team`, only its projects are read.

### What happened: one incident on one timeline

```bash
orbee incident -p solis-dev --workload checkout --since 24h   # the latest episode, its leads, who can reach it
orbee incident -p solis-dev --since 7d --at 2026-11-27T22:30  # the episode at that time
orbee incident -p solis-dev -o json                            # every episode with its top lead
orbee incident -p solis-dev --related net-host --since 3d      # also the Shared VPC host's changes
```

The failures of a project, or one workload, are split into episodes: more than 30 minutes without
an error starts a new one. The changes of the project are read once, and every change around the
start of an episode becomes a lead, ranked by a rule anyone can check:

- **strong**: changes the failing workload, at most 15 minutes before the first failure;
- **possible**: changes it earlier, changes another workload of the project just before (a
  dependency), or changes access, a secret, the network, a database or an API of the project;
- **excluded**: after the first failure, so it cannot have started it (a fix, a rollback).

Besides the project, the changes of the folders and organization above it are read, and those of
the projects named with `--related` (a Shared VPC host, a project of shared secrets): a change
there is possible when it is cross-cutting (network, IAM, secret, database, API), unlikely
otherwise. Leads are hypotheses, never causes. The answer lists where it read the changes and
what it did not check: other projects, metrics. When a noisy outage fills the read limit, older
failures are read until a quiet period shows its start; when it stays cut, the start is marked
uncertain, bounded by the first failure of the window, and the changes are read from the window's start.

### Who has access: every IAM binding of the organization

```bash
orbee access --risky                            # public, owner/editor to a person, external members
orbee access --member alice@                    # everything alice holds, on any resource
orbee access --role roles/owner -o json         # every owner, with a console link to the IAM page
orbee access --resource billing --role storage  # who holds a storage role on the billing resources
```

One Cloud Asset Inventory search covers the organization (or folder), its folders, projects and
resources with a policy of their own: buckets, datasets, secrets, service accounts. Each binding
carries its risks: **public** (`allUsers`, `allAuthenticatedUsers`), **basic_role** (owner or
editor granted to a person or a group) and **external** (a user, group or domain outside the
organization's domain, or `ORBEE_INTERNAL_DOMAINS`). Bindings are direct: access through a
group's members or inherited from a parent is not expanded. Who granted a binding, and when, is
`orbee changes --method SetIamPolicy`.

The command exits with code `3` when the bindings are cut at `--limit`. Cloud Asset Inventory is
billed and quota-checked on `ORBEE_PROJECT`: enable `cloudasset.googleapis.com` there.

### Coverage: where Orbee is blind

```bash
orbee coverage --since 7d
```

Lists every active project under `ORBEE_PARENT`, nested folders included, with the time of its
last change in the window (read project by project, or in one query with `--source bigquery`) and
whether its logs can be read. A project seen in the audit logs but
not listed (a folder you cannot browse), or whose logs cannot be read, is a blind spot: the
command exits with code `3`. A project without change in the window is quiet, not blind.

Every answer states its source, its scope, the time window and when it was collected. A source
Orbee cannot read is an error, never an empty answer.

### Doctor: what you miss, and how to grant it

```bash
orbee doctor --member group:platform-team@example.com
orbee doctor -p solis-dev -p solis-prd        # projects named one by one, without a parent
```

Checks, with `testIamPermissions`, every permission each source needs, and prints the commands
an administrator runs to grant what is missing. Orbee never grants anything itself. Exits with
code `3` when a permission is missing or could not be checked.

## Permissions

Every permission Orbee needs is a read. The list is the contract, short enough to review:

| Where | Permissions | For | Predefined alternative |
|---|---|---|---|
| Organization or folder (inherited) | `resourcemanager.projects.get`, `resourcemanager.folders.get`, `logging.logEntries.list`, `cloudasset.assets.searchAllIamPolicies` | `access`, `changes`, `coverage`, `failures` | `roles/browser` + `roles/logging.viewer` + `roles/cloudasset.viewer` |
| Each project, without a parent | `resourcemanager.projects.get`, `logging.logEntries.list` | `changes -p`, `failures -p` | `roles/logging.viewer` |
| Project hosting the dataset (BigQuery source only) | `bigquery.jobs.create` | `changes`, `coverage` | `roles/bigquery.jobUser` |
| Audit dataset (BigQuery source only) | `bigquery.tables.get`, `bigquery.tables.getData` | `changes`, `coverage` | `roles/bigquery.dataViewer` |

With the default Cloud Logging source, the first line is all Orbee needs. `bigquery.jobs.create`
runs queries; without `bigquery.tables.create` or `updateData` it cannot write a table. The
`org-setup` module creates the first four permissions as the **Orbee Reader**
custom role (`parent_reader_access = "custom_role"`, the default), or grants the predefined roles
(`"predefined_roles"`), or nothing (`"none"`) when access is granted project by project. Reading
every project's logs is the sensitive part: grant it on a folder, or project by project, when the
whole organization is too wide.

Granting these roles is the one step that writes, done once by an administrator: `orbee doctor`
prints the commands, and the `org-setup` module does it in Terraform (`export_audit_logs` left
off: the role and its bindings, nothing else).

## Claude Code plugin

The plugin bundles the MCP server and the `orbee` skill, which teaches the agent to pick the right
tool, narrow before widening, read every episode of an incident and keep the answer contract:

```
/plugin install orbee --marketplace tosun-si/orbee
```

Claude Code asks for the project (`ORBEE_PROJECT`) and the organization or folder (`ORBEE_PARENT`)
when the plugin is enabled; `claude plugin configure orbee` changes them. It runs `uvx orbee mcp`:
[uv](https://docs.astral.sh/uv/) must be installed. The skill alone, for other agents that read
[Agent Skills](https://agentskills.io), is [`skills/orbee`](skills/orbee/SKILL.md).

## MCP server

`orbee mcp` serves the same questions as read-only MCP tools over stdio: `list_changes`,
`list_failures`, `list_access`, `investigate_incident`, `coverage` and `doctor`, with the same `source` choice
as `--source`. Their
answers are sized for an agent's context: `list_failures` returns a summary per project and kind
then the 50 most recent groups with their first line (`detail` for full messages), and
`list_changes` takes an end (`until`) so an agent asks what changed in the hour before a failure,
not over the week. They return the same payloads as `-o json`, and the server instructions tell
the agent to keep the answer contract: state source, scope, window and collection time, treat
unreachable projects as unknown, and present a change near a failure as a hypothesis.

```bash
# Claude Code
claude mcp add orbee -e ORBEE_PROJECT=my-platform-tools \
  -e ORBEE_PARENT=organizations/123456789012 -- uvx orbee mcp
```

```json
// Gemini CLI: ~/.gemini/settings.json
{
  "mcpServers": {
    "orbee": {
      "command": "uvx",
      "args": ["orbee", "mcp"],
      "env": {
        "ORBEE_PROJECT": "my-platform-tools",
        "ORBEE_PARENT": "organizations/123456789012"
      }
    }
  }
}
```

The server uses your Application Default Credentials, and reads its settings on the first tool
call: a missing setting comes back as a tool error naming the variable.

## Principles

- **Read-only.** No write to your platform.
- **Unknown is not healthy.** What Orbee cannot see is reported as such.
- **Observed, not guessed.** A change close to an incident is a lead to check, not a cause.
- **Evidence.** Every fact links back to its source.
- **Bounded cost.** Every read has a time window and a limit.
- **No copy by default.** Logs are read where Google keeps them; exporting them is opt-in.

## Development

```bash
cp .envrc.example .envrc && direnv allow
uv sync
uv run pytest
uv run ruff check . && uv run ruff format --check .
```

## License

[Apache 2.0](LICENSE)
