async def METHOD_NAME(
    self, *, message_id: str, worker_id: str, worker_config: inference.WorkerConfig
) -> models.DbMessage:
    """
    Update an assistant message in the database to be allocated to a specific worker.
    The message must be in `pending` state. An exception is raised if the message has timed out or was cancelled.
    """
    logger.debug(f"Starting work on message {message_id}")
    message = await self.get_assistant_message_by_id(message_id)
    if settings.assistant_message_timeout > 0:
        message_age_in_seconds = (datetime.datetime.utcnow() - message.created_at).total_seconds()
        if message_age_in_seconds > settings.assistant_message_timeout:
            message.state = inference.MessageState.timeout
            await self.session.commit()
            await self.session.refresh(message)
            raise chat_schema.MessageTimeoutException(message=message.to_read())
    if message.state == inference.MessageState.cancelled:
        raise chat_schema.MessageCancelledException(message_id=message_id)
    if message.state != inference.MessageState.pending:
        raise fastapi.HTTPException(status_code=400, detail="Message is not pending")
    message.state = inference.MessageState.in_progress
    message.work_begin_at = datetime.datetime.utcnow()
    message.worker_id = worker_id
    message.worker_config = worker_config
    await self.session.commit()
    logger.debug(f"Started work on message {message_id}")
    await self.session.refresh(message)
    return message