Skip to content

feat(python,cli): labels parity — Python SDK + CLI inbox filter#174

Merged
jiashuoz merged 1 commit into
mainfrom
feat/labels-python-cli-parity
May 28, 2026
Merged

feat(python,cli): labels parity — Python SDK + CLI inbox filter#174
jiashuoz merged 1 commit into
mainfrom
feat/labels-python-cli-parity

Conversation

@jiashuoz
Copy link
Copy Markdown
Member

Summary

Brings the labels feature to the Python SDK (sync + async) and the CLI inbox command. The TS SDK + CLI labels command already shipped in #173; this closes the remaining surface gaps so all clients are at parity.

What's added

Python SDK — api.py and async_client.py (raw HTTP)

  • list_messages(..., labels: list[str] | None = None) — emitted as repeated ?labels= query params
  • update_message_labels(agent_email, message_id, body)UpdateMessageResponse (PATCH)

Python SDK — client.py and async_client.py (high-level)

  • get_messages(..., labels=...) plumbs the filter through
  • MessageSummary.labels: list[str] (always present, defaults to [])
  • update_message_labels(message_id, add_labels=..., remove_labels=..., agent_email=...) — returns the post-update label list directly

CLI

  • e2a inbox --label <l> [--label <l> ...] — flag repeats to AND-match
  • getFlags exported so the args test can cover repeated-flag parsing

Verification

  • Python: 197 tests pass (+6 new — PATCH on raw + high-level sync + async, labels surfaced on MessageSummary, filter emission, empty-delta echo)
  • CLI: 103 tests pass (+3 new getFlags coverage)

Backwards compatibility

  • MessageSummary.labels is defaulted (field(default_factory=list)) so any existing positional constructors keep working.
  • list_messages / get_messages keep all existing keyword-only params; labels is appended at the end and optional.

Test plan

  • pytest sdks/python/tests/ — 197 pass
  • npm test --workspace @e2a/cli — 103 pass
  • Manual: e2a inbox --label urgent --label follow-up against a live deployment

🤖 Generated with Claude Code

Brings the labels feature to the Python SDK (sync + async) and the CLI
inbox command, matching what the TS SDK and CLI labels command already
ship.

Python SDK (sync + async):
- api.py / async_client.py: list_messages accepts `labels: list[str]`
  emitted as repeated `?labels=` query params (matches the server-side
  parser shape).
- api.py / async_client.py: new `update_message_labels(agent_email,
  message_id, body)` method calling PATCH /messages/{id}.
- client.py / async_client.py: get_messages accepts `labels=...` and
  surfaces `labels: list[str]` on each MessageSummary.
- client.py / async_client.py: new high-level
  `update_message_labels(message_id, add_labels=..., remove_labels=...,
  agent_email=...)` returning the post-update label list.
- handler.py: MessageSummary gains `labels: list[str] = field(default_factory=list)`,
  defaulted to keep existing positional constructors working.

CLI:
- `e2a inbox --label <l> [--label <l> ...]` AND-matches; flag repeats.
- getFlags exported from bin/e2a.ts so the args test can cover it.

Tests:
- Python: 6 new (api: PATCH + repeated labels query; sync client:
  surfaces labels, filters by labels, update_message_labels happy +
  empty-delta echoes current; async client: PATCH + filter). 197 pass.
- CLI: 3 new getFlags tests covering single, repeated, and absent
  cases. 103 pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jiashuoz jiashuoz merged commit 467eefa into main May 28, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant