Skip to content

fix: keep non-gRPC transports optional - #739

Open
simonyang08 wants to merge 1 commit into
openagents-org:developfrom
simonyang08:codex/openagents-647-resubmit
Open

simonyang08 wants to merge 1 commit into
openagents-org:developfrom
simonyang08:codex/openagents-647-resubmit

Conversation

@simonyang08

Copy link
Copy Markdown

Resubmits #647 per the invitation in #647 (comment) — fresh, non-draft, and rebased onto current develop (81289018). The original analysis and approach are unchanged; thanks @zomux for confirming the problem is still live.

Problem

grpcio is only an optional extra in pyproject.toml, yet sdk/openagents/sdk/transports/__init__.py imported the gRPC transport eagerly, so none of the transports were importable without grpcio installed — including the HTTP transport that has no gRPC dependency at all.

Still reproducible on current develop (verified today): with grpc blocked from the import system, from openagents.sdk.transports import HttpTransport raises

ImportError: grpcio is required for gRPC transport. Install with: pip install openagents[sdk]

Fix (lazy exports)

  • transports/__init__.py no longer imports the gRPC module up front; it exposes GRPCTransport via a module-level __getattr__ that only imports .grpc when the name is actually accessed, raising the same actionable error if grpcio is missing.
  • topology.py imports .transports.grpc symbols directly where they are used, so it does not force the lazy export machinery.

Verification

  • tests/test_optional_grpc.py: with grpc blocked, HttpTransport (and friends) import cleanly, grpc never lands in sys.modules, and accessing GRPCTransport raises the actionable install hint. 1 passed on this branch; on pure develop the same import raises (RED confirmed today).
  • Cherry-pick applied cleanly onto develop tip 81289018; no other files touched (topology.py, transports/__init__.py, one new test).

@vercel

vercel Bot commented Sep 30, 2026

Copy link
Copy Markdown

@ppt5928-dot is attempting to deploy a commit to the Raphael's projects Team on Vercel.

A member of the Team first needs to authorize it.

This branch has not been deployed

No deployments
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.

2 participants