Steps
Python SDK - Steps resource API reference
Steps resource for step execution operations.
AsyncSteps
Asynchronous step execution operations.
Example:
>>> async with AsyncClient(api_key="...") as client:
... status = await client.steps.run_async(
... step_id="step_extraction",
... file=Path("document.pdf")
... )
... result = await status.wait()
... print(result.data)Arguments:
client: The parent async client instance.
Methods:
get_status
def get_status(self, execution_id: str) -> StepExecutionStatusGet the status of a step execution.
Arguments:
execution_id: The execution ID returned by run_async().
Returns:
The current execution status.
run_async
def run_async(self, step_id: str, file: FileInput | None = None, url: str | None = None, file_base64: str | None = None, content_type: str | None = None, document_metadata: dict[str, Any] | None = None) -> StepExecutionStatusExecute a step asynchronously.
Arguments:
step_id: The ID of the step to execute. file: File to process (Path, bytes, or file-like object). url: URL of the document to process (alternative to file). file_base64: Base64-encoded document (alternative to file). content_type: Content type of the file. Auto-detected if not provided. document_metadata: Additional metadata to include with the document.
Returns:
The initial execution status with execution_id.
Properties:
with_raw_response: Access methods that return raw HTTP responses.
Steps
Synchronous step execution operations.
Steps allow executing predefined document processing workflows.
Example:
>>> client = Client(api_key="...")
>>> status = client.steps.run_async(
... step_id="step_extraction",
... file=Path("document.pdf")
... )
>>> result = status.wait()
>>> print(result.data)Arguments:
client: The parent client instance.
Methods:
get_status
def get_status(self, execution_id: str) -> StepExecutionStatusGet the status of a step execution.
Arguments:
execution_id: The execution ID returned by run_async().
Returns:
The current execution status.
Example:
>>> status = client.steps.get_status("exec_abc123")
>>> if status.is_success():
... print(status.data)run_async
def run_async(self, step_id: str, file: FileInput | None = None, url: str | None = None, file_base64: str | None = None, content_type: str | None = None, document_metadata: dict[str, Any] | None = None) -> StepExecutionStatusExecute a step asynchronously.
Initiates step execution and returns immediately with an execution ID. Use get_status() to poll for completion.
Arguments:
step_id: The ID of the step to execute. file: File to process (Path, bytes, or file-like object). url: URL of the document to process (alternative to file). file_base64: Base64-encoded document (alternative to file). content_type: Content type of the file. Auto-detected if not provided. document_metadata: Additional metadata to include with the document.
Returns:
The initial execution status with execution_id.
Raises:
ValueError: If no file input is provided. BadRequestError: If the request is invalid. NotFoundError: If the step doesn't exist.
Example:
>>> status = client.steps.run_async(
... "step_invoice_extraction",
... file=Path("invoice.pdf")
... )
>>> print(f"Execution ID: {status.execution_id}")Properties:
with_raw_response: Access methods that return raw HTTP responses.