Skip to content
CCinder
Injecting Runtime Context

Guides

Injecting Runtime Context

Pass application state into local resolution and fallback in a deliberate, inspectable way.

Runtime context is the right place for app state that matters to intent selection but does not belong in semantic tags.

Typical example

ts
4 lines
Cinder.setContextProvider(() => ({
  accountId: selectedAccountId,
  region: selectedRegion,
}));

Async example

ts
5 lines
Cinder.setContextProvider(async () => {
  return {
    accountId: await getSelectedAccountId(),
  };
});

Good use cases

  • current account or tenant
  • selected region
  • workflow state
  • app-specific environment values

Practical note

Use Cinder.getContext() to inspect what the runtime currently sees.

Continue reading