Skip to main content

Python class

BaseContext

BaseContext​

class max.interfaces.BaseContext(*args, **kwargs)

source

Bases: Protocol

Core interface for request lifecycle management across all of MAX, including serving, scheduling, and pipelines.

This protocol is intended to provide a unified, minimal contract for request state and status handling throughout the MAX stack. Each pipeline variant (for example, text generation, embeddings, image generation) is expected to extend this interface by creating their own modality-specific context classes that implement this protocol and add additional functionality relevant to their particular use case.

The minimal interface ensures that all context types can be handled uniformly by the scheduling and serving infrastructure, while allowing pipeline-specific implementations to add their own state management, input validation, and result handling.

is_done​

property is_done: bool

source

Whether the request has completed generation.

request_id​

property request_id: RequestID

source

Unique identifier for the request.

status​

property status: GenerationStatus

source

Current generation status of the request.