feat(python,cli): labels parity — Python SDK + CLI inbox filter#174
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.pyandasync_client.py(raw HTTP)list_messages(..., labels: list[str] | None = None)— emitted as repeated?labels=query paramsupdate_message_labels(agent_email, message_id, body)→UpdateMessageResponse(PATCH)Python SDK —
client.pyandasync_client.py(high-level)get_messages(..., labels=...)plumbs the filter throughMessageSummary.labels: list[str](always present, defaults to[])update_message_labels(message_id, add_labels=..., remove_labels=..., agent_email=...)— returns the post-update label list directlyCLI
e2a inbox --label <l> [--label <l> ...]— flag repeats to AND-matchgetFlagsexported so the args test can cover repeated-flag parsingVerification
Backwards compatibility
MessageSummary.labelsis defaulted (field(default_factory=list)) so any existing positional constructors keep working.list_messages/get_messageskeep all existing keyword-only params;labelsis appended at the end and optional.Test plan
pytest sdks/python/tests/— 197 passnpm test --workspace @e2a/cli— 103 passe2a inbox --label urgent --label follow-upagainst a live deployment🤖 Generated with Claude Code