Skip to content

Add draft, attachment, and RAG example scripts - #1

Merged
josephfeleke merged 2 commits into
mainfrom
examples/add-draft-attachment-rag
May 18, 2026
Merged

josephfeleke merged 2 commits into
mainfrom
examples/add-draft-attachment-rag

Conversation

@josephfeleke

@josephfeleke josephfeleke commented May 14, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Three new runnable examples under examples/:
    • draft_workflow.py — create → update → send a draft (covers the three draft-tool verbs).
    • attachment_demo.py — outbound base64 SendAttachmentSpec and inbound presigned-URL download.
    • rag_inbox.py — keyword search via AgentMailRetriever, plus an opt-in semantic path that pipes AgentMailLoader().load() into InMemoryVectorStore + OpenAI (only runs when OPENAI_API_KEY is set).
  • Refactor examples/send_one_email.py to split env wiring (main()) from the actual send call (run(client, ...)), matching the structure used by the new examples and making it unit-testable.
  • New tests/unit_tests/test_examples.py (7 tests) drives each example's run()/helper against a mocked SDK — no network, no real keys, no LLM calls.

Test plan

  • ruff check . — clean.
  • pytest — 35 passed (28 existing + 7 new) in ~0.6s.
  • Each example module imports cleanly under python -c "import <example>".
  • Reviewer spot-checks the docstring env-var lists against the helpers each example calls.

Summary by cubic

Add three runnable examples for drafts, attachments, and inbox RAG search, and refactor send_one_email for consistency and testability. Includes unit tests that mock the SDK to run everything without network calls or real keys.

  • New Features

    • examples/draft_workflow.py: create → update → send a draft.
    • examples/attachment_demo.py: send base64 attachment via SendAttachmentSpec and resolve a presigned download URL.
    • examples/rag_inbox.py: keyword search with AgentMailRetriever; optional semantic path using AgentMailLoader + in-memory vectors with OpenAI when OPENAI_API_KEY is set.
  • Bug Fixes

    • CI: configure setup-uv@v3 to cache from pyproject.toml to restore caching and unblock the matrix.

Written for commit 4ca19ee. Summary will update on new commits. Review in cubic

Three new runnable examples cover the surfaces the existing send_one_email
script didn't: draft create/update/send, base64 attachment round-trip, and
loader/retriever search over an inbox (with an optional semantic path).
send_one_email is refactored to share the same run()/main() shape so all
four examples are unit-testable. Adds tests/unit_tests/test_examples.py
driving each example's run helper with a mocked SDK — no network or LLM
calls required.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 5 files

The setup-uv@v3 action defaults to caching off **/uv.lock, which this
repo doesn't ship. Every CI run since the 0.2.0 workflow landed has
failed at the setup-uv step before any code ran. Pointing the cache
dependency glob at pyproject.toml lets the action build a cache key
from our deps source of truth and unblocks the matrix.
@josephfeleke
josephfeleke merged commit 0379efd into main May 18, 2026
6 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