Class: FallbackVideoProxy
Defined in: packages/agentos/src/core/video/FallbackVideoProxy.ts:108
An IVideoGenerator that wraps an ordered chain of video providers and implements automatic failover for every operation.
Retry chain logic
Providers are tried left-to-right (index 0 first). The first provider that succeeds returns immediately. When a provider throws:
- If it is NOT the last provider: a
video:generate:fallbackevent is emitted and the next provider is tried. - If it IS the last provider: an
AggregateErrorcontaining every collected error is thrown. - If the chain is empty: an
Error('No providers in video fallback chain')is thrown immediately.
For the optional imageToVideo operation, providers whose
IVideoGenerator.supports returns false for 'image-to-video'
are silently skipped, since they are structurally incapable rather than
transiently failing.
Implements
Constructors
Constructor
new FallbackVideoProxy(
chain,emitter):FallbackVideoProxy
Defined in: packages/agentos/src/core/video/FallbackVideoProxy.ts:134
Creates a new FallbackVideoProxy wrapping the given provider chain.
Parameters
chain
Ordered list of video providers to try. Must contain at least one entry for operations to succeed (an empty chain always throws).
emitter
EventEmitter
EventEmitter on which video:generate:fallback events
are published so callers can observe the failover path.
Returns
FallbackVideoProxy
Example
const proxy = new FallbackVideoProxy(
[runwayProvider, pikaProvider],
new EventEmitter(),
);
Properties
defaultModelId?
readonlyoptionaldefaultModelId:string
Defined in: packages/agentos/src/core/video/FallbackVideoProxy.ts:116
Default model from the first provider, if set.
Implementation of
IVideoGenerator.defaultModelId
isInitialized
readonlyisInitialized:boolean=true
Defined in: packages/agentos/src/core/video/FallbackVideoProxy.ts:113
Always true — the proxy is ready as soon as it is constructed.
Implementation of
providerId
readonlyproviderId:string
Defined in: packages/agentos/src/core/video/FallbackVideoProxy.ts:110
Identifier derived from the first provider in the chain.
Implementation of
Methods
generateVideo()
generateVideo(
request):Promise<VideoResult>
Defined in: packages/agentos/src/core/video/FallbackVideoProxy.ts:182
Generate a video from a text prompt, falling back through the provider chain on failure.
Parameters
request
The generation request forwarded to each provider.
Returns
Promise<VideoResult>
The result from the first provider that succeeds.
Throws
When every provider in the chain fails.
Throws
When the chain is empty.
Implementation of
imageToVideo()
imageToVideo(
request):Promise<VideoResult>
Defined in: packages/agentos/src/core/video/FallbackVideoProxy.ts:204
Generate a video from a source image, falling back through providers that support image-to-video.
Providers whose IVideoGenerator.supports returns false for
'image-to-video' are silently skipped.
Parameters
request
The image-to-video request forwarded to each capable provider.
Returns
Promise<VideoResult>
The result from the first provider that succeeds.
Throws
When every provider fails or does not support image-to-video.
Implementation of
initialize()
initialize(
_config):Promise<void>
Defined in: packages/agentos/src/core/video/FallbackVideoProxy.ts:150
No-op initialisation — individual providers in the chain should already be initialised before being passed to the proxy.
Parameters
_config
Record<string, unknown>
Returns
Promise<void>
Implementation of
shutdown()
shutdown():
Promise<void>
Defined in: packages/agentos/src/core/video/FallbackVideoProxy.ts:228
Shuts down all providers in the chain. Errors are caught per-provider so a single provider's failure does not prevent the others from cleaning up.
Returns
Promise<void>
Implementation of
supports()
supports(
capability):boolean
Defined in: packages/agentos/src/core/video/FallbackVideoProxy.ts:165
Returns true if at least one provider in the chain supports the
given capability.
Parameters
capability
The capability to query.
"text-to-video" | "image-to-video"
Returns
boolean