Skip to content

Feature Request: CBC event handling - CloudEvent parsing, dispatch, and feature status API #412

Open

Description

@soumyadey

Describe the Problem

The cbc module added in v0.59.0 covers the pull side of the CBC integration: fetching tenant configuration on demand. However, CBC also pushes CloudEvents to application or agent webhook endpoints whenever configuration changes or AI features are toggled. Currently there is no SDK support for receiving, parsing, validating, or dispatching these events.

Without SDK support, every application/agent team must:

  • Manually parse raw CloudEvent payloads from incoming HTTP requests
  • Validate the type, specversion, and data fields themselves
  • Route events to the appropriate handler

There is also no way to query the current feature activation state via CBCClient, meaning applications cannot check feature status without implementing a separate API call.

Propose a Solution

Two additions to the existing sap_cloud_sdk.cbc module:


1. Event handler API

A lightweight event handler that registers callbacks by event type, parses incoming CloudEvents into typed CBC event objects, and dispatches them to the appropriate callback.

Three event types to support:

  • cbc.notification.consumptionversion.created
  • cbc.notification.consumptionversion.updated
  • cbc.notification.feature.activation.v1

Proposed API sketch:

from sap_cloud_sdk import cbc

handler = cbc.CBCEventHandler()

def handle_cv_change(event: cbc.ConsumptionVersionEvent) -> None:
    # event.app_tenant_id, event.consumption_version_id
    ...

def handle_features(event: cbc.FeatureActivationEvent) -> None:
    # event.features: list[cbc.FeatureStatus]
    for f in event.features:
        print(f.feature_id, f.is_enabled())

handler.on_consumption_version_event(handle_cv_change)
handler.on_feature_activation_event(handle_features)

# In your web framework's webhook route:
handler.handle_request(request.headers, request.body)

CBCEventHandler.handle_request(headers, body) parses the incoming CloudEvent, validates type, and routes to the registered callback. Raises CBCEventError (subclass of CBCError) on malformed envelopes.


2. Feature status pull API on CBCClient

v0.59.0 introduced CBCClient with methods to pull business configuration from CBC. AI feature status was out of scope at the time. This adds get_feature_statuses() to complete the client.

statuses = cbc_client.get_feature_statuses()

if statuses.is_enabled("my-feature-id"):
    ...

Describe Alternatives

  • Each team parses events themselves: duplicated boilerplate with no consistency.
  • Generic CloudEvents library only: cloudevents Python SDK handles the envelope but provides no CBC-specific dispatch, typed models, or integration with CBCClient.

Affected Development Phase

Development

Impact

Impaired

Timeline

Active development is underway. I am willing to work on this and open a pull request once the issue is approved.

Activity

  1. self-assigned this
    on Oct 21, 2026
  2. NicoleMGomes commented on Oct 21, 2026

    @NicoleMGomes
    Contributor

    Hi,

    The contribution can proceed. Please share the PR with us only when all checks are ok.

    Thank you,
    Nicole Gomes

  3. soumyadey commented on Oct 22, 2026

    @soumyadey
    MemberAuthor

    Hi @NicoleMGomes ,

    Raised PR #422. I have run the /review-pr and /security-review skills. Both pass clean. I have also run the updated SDK against a real demo agent which is integrated with CBC. Evidence of test results and skill reports are provided in the PR description and PR comment respectively.

    Thanks,
    Soumya Dey

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions